Closed christopherayork closed 2 years ago
Thank you, I didn't pay attention to that. In Flutter SDK 3.0.0, WidgetsBinding.instance wouldn't return nullable anymore, that's why I didn't get an error.
Throws this error due to WidgetsBinding being nullable:
/C:/SDKs/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_screenutil-5.5.3/lib/src/screen_util.dart:104:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null. - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/SDKs/flutter/flutter/packages/flutter/lib/src/widgets/binding.dart'). package:flutter/…/widgets/binding.dart:1 Try calling using ?. instead. WidgetsBinding.instance.addPostFrameCallback((_) { ^^^^^^^^^^^^^^^^^^^^
Can we update this with the nullish access operator? Or a non-null assertion, if we're sure WidgetsBinding is initialized.
Same error in iOS
Throws this error due to WidgetsBinding being nullable:
/C:/SDKs/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_screenutil-5.5.3/lib/src/screen_util.dart:104:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null. - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/SDKs/flutter/flutter/packages/flutter/lib/src/widgets/binding.dart'). package:flutter/…/widgets/binding.dart:1 Try calling using ?. instead. WidgetsBinding.instance.addPostFrameCallback((_) { ^^^^^^^^^^^^^^^^^^^^
Can we update this with the nullish access operator? Or a non-null assertion, if we're sure WidgetsBinding is initialized.
Same error in iOS
Use latest. V5.5.3+1
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
https://github.com/OpenFlutter/flutter_screenutil/blob/7aad18983c07d9c7e855b4bfd71dded457f7badf/lib/src/screen_util.dart#L104
Throws this error due to WidgetsBinding being nullable:
Can we update this with the nullish access operator? Or a non-null assertion, if we're sure WidgetsBinding is initialized.