Open harkairt opened 8 months ago
Please refer to this repository: https://github.com/harkairt/test_compile_error especially this line
Steps:
fvm use
flutter pub get && flutter run -d 'chrome'
flutter test
Error: Method 'toTabVisibilityChangeEvent' cannot be called on 'String?' because it is potentially null. Try calling using ?. instead.
final event = document.visibilityState.toTabVisibilityChangeEvent(); // final event = (document.visibilityState ?? '').toTabVisibilityChangeEvent();
note: the IDE will warn about unnecessary fallback '' since it recognizes visibilityState to be String and not String?
''
visibilityState
String
String?
Please refer to this repository: https://github.com/harkairt/test_compile_error especially this line
Steps:
fvm use
(or simply use a global flutter 3.16.5)flutter pub get && flutter run -d 'chrome'
flutter test
Error: Method 'toTabVisibilityChangeEvent' cannot be called on 'String?' because it is potentially null. Try calling using ?. instead.
note: the IDE will warn about unnecessary fallback
''
since it recognizesvisibilityState
to beString
and notString?