Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to null-safety #136

Merged
merged 12 commits into from Aug 12, 2021
5 changes: 2 additions & 3 deletions bin/templates/platformconstants.dart.dart
@@ -1,5 +1,4 @@
String getPrefix(Object str) =>
((str as String).length > 26) ? '\n ' : ' ';
String getPrefix(String str) => (str.length > 26) ? '\n ' : ' ';

String $(Map<String, dynamic> c) => '''
// ignore_for_file: public_member_api_docs
Expand All @@ -10,7 +9,7 @@ ${c['types'].map((_) => " static const int ${_['name']} ="
}

class PlatformMethod {
${c['methods'].map((_) => " static const String ${_['name']} =${getPrefix(_['value'])}'${_['value']}';").join('\n')}
${c['methods'].map((_) => " static const String ${_['name']} =${getPrefix(_['value'] as String)}'${_['value']}';").join('\n')}
}

${c['objects'].map((_) => '''
Expand Down
130 changes: 66 additions & 64 deletions example/lib/main.dart

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/lib/nested_realtime_events.dart
Expand Up @@ -21,7 +21,7 @@ void listenRealtimeConnection(ably.Realtime realtime) {

//DISPOSE ON CONNECTED
final stream = realtime.connection.on();
StreamSubscription omegaSubscription;
late StreamSubscription omegaSubscription;
omegaSubscription = stream.listen((stateChange) async {
ben-xD marked this conversation as resolved.
Show resolved Hide resolved
print('DISPOSABLE LISTENER ω :: Change event arrived!:'
' ${stateChange.event}');
Expand All @@ -45,7 +45,7 @@ void listenRealtimeConnection(ably.Realtime realtime) {
});

StreamSubscription preZetaSubscription;
StreamSubscription postZetaSubscription;
late StreamSubscription postZetaSubscription;
preZetaSubscription = realtime.connection.on().listen((stateChange) {
//This listener "pre ζ" will be cancelled from γ
print('NESTED LISTENER "pre ζ": ${stateChange.event}');
Expand Down
4 changes: 2 additions & 2 deletions example/lib/provisioning.dart
Expand Up @@ -54,7 +54,7 @@ class AppKey {

Future<Map> _provisionApp(
final String environmentPrefix, [
Map<String, List> appSpec,
Map<String, List>? appSpec,
]) async {
appSpec ??= _appSpec;
final url = 'https://${environmentPrefix}rest.ably.io/apps';
Expand All @@ -74,7 +74,7 @@ Future<Map> _provisionApp(

Future<AppKey> provision(
String environmentPrefix, [
Map<String, List> appSpec,
Map<String, List>? appSpec,
]) async {
final result = await const RetryOptions(
maxAttempts: 5,
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.lock
Expand Up @@ -108,14 +108,14 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "1.11.1"
retry:
dependency: "direct main"
description:
name: retry
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.1.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -179,4 +179,4 @@ packages:
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
flutter: ">=2.2.2"
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Expand Up @@ -3,14 +3,14 @@ description: Demonstrates how to use the Ably Flutter plugin.
publish_to: 'none'

environment:
sdk: ">=2.6.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

http: ^0.13.3
retry: ^3.0.1
retry: ^3.1.0

dev_dependencies:
ably_flutter:
Expand All @@ -19,7 +19,7 @@ dev_dependencies:
sdk: flutter

# Stricter Linting
pedantic: ^1.0.0
pedantic: ^1.11.1

flutter:
uses-material-design: true
2 changes: 1 addition & 1 deletion example/test/widget_test.dart
Expand Up @@ -17,7 +17,7 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(widget) => widget is Text && widget.data.startsWith('Running on:'),
(widget) => widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down