-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.Use area-dart-cli for issues related to the 'dart' command like tool.
Description
When I compile this:
void main() {
const bool test = true;
print(test!); // ignore: unnecessary_non_null_assertion
}
...I get:
test.dart:3:9: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
print(test!); // ignore: unnecessary_non_null_assertion
^
true
I'm happy for the analyzer to give the warning, but why is the compiler also doing so? And how do I silence it?
The context is that I have code (a Flutter plugin) that needs to compile against two versions of an API. In one version (Flutter stable) a particular field is nullable, in the more recent version (Flutter master), it's non-nullable. I don't mind having lots of // ignores in the code during the transition, but I don't want users to be faced with lots of warnings they can't do anything about when compiling their apps.
apoleo88, wujek-srujek, mono0926, sullenel, kuhnroyal and 8 morecgutierr-zgz and renancaraujo
Metadata
Metadata
Assignees
Labels
area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.Use area-dart-cli for issues related to the 'dart' command like tool.