ably / ably-flutter

A wrapper around our Cocoa and Java client library SDKs, providing iOS and Android support for those using Flutter and Dart.
https://ably.com/download
Apache License 2.0
60 stars 16 forks source link

1.2.14 / Flutter 3.0.0 Operand of null-aware operation #412

Closed 1N50MN14 closed 2 years ago

1N50MN14 commented 2 years ago

Flutter still complains about that with 1.2.14:

../../../../Applications/flutter/.pub-cache/hosted/pub.dartlang.org/ably_flutter-1.2.14/lib/src/platform/src/streams_channel.dart:54:23: Warning: Operand of null-aware operation '!' has type 'ServicesBinding' which excludes null.
 - 'ServicesBinding' is from 'package:flutter/src/services/binding.dart' ('../../../../Applications/flutter/packages/flutter/lib/src/services/binding.dart').
      ServicesBinding.instance!.defaultBinaryMessenger

../../../../Applications/flutter/.pub-cache/hosted/pub.dartlang.org/ably_flutter-1.2.14/lib/src/platform/src/streams_channel.dart:87:23: Warning: Operand of null-aware operation '!' has type 'ServicesBinding' which excludes null.
 - 'ServicesBinding' is from 'package:flutter/src/services/binding.dart' ('../../../../Applications/flutter/packages/flutter/lib/src/services/binding.dart').
      ServicesBinding.instance!.defaultBinaryMessenger      

┆Issue is synchronized with this Jira Task by Unito

ikurek commented 2 years ago

@1N50MN14 thank you for the report. I'm afraid there's nothing we can do with this, if you take a look at these methods, there is a comment and ignored lint warning for that:

// We need to keep this null-asserted for backwards compatibility with
// Flutter versions before 3.0.0
// ignore: unnecessary_non_null_assertion

The ServicesBinding.instance became non-nullable with Flutter 3.0.0, but we still need to keep the null safety here, because minimum required Flutter version we support is 2.5.0, where the ServicesBinding.instance can still be nullable. Updating these components would require us to drop support for Flutter versions before 3.0.0, which isn't planned for now

jerinho commented 2 years ago

@1N50MN14 thank you for the report. I'm afraid there's nothing we can do with this, if you take a look at these methods, there is a comment and ignored lint warning for that:

// We need to keep this null-asserted for backwards compatibility with
// Flutter versions before 3.0.0
// ignore: unnecessary_non_null_assertion

The ServicesBinding.instance became non-nullable with Flutter 3.0.0, but we still need to keep the null safety here, because minimum required Flutter version we support is 2.5.0, where the ServicesBinding.instance can still be nullable. Updating these components would require us to drop support for Flutter versions before 3.0.0, which isn't planned for now

what do you mean you can do nothing? it's just a null-safety thing. do you mean both minimum and maximum is 2.5.0? haha