widgetbook icon indicating copy to clipboard operation
widgetbook copied to clipboard

Potential null value of `WidgetsBinding.instance`

Open guillempuche opened this issue 2 years ago • 2 comments

It could not access toFocusManager because the instance of WidgetsBinding could be null.

Environment:

List of issues which are fixed by the PR

Error:

Property `focusManager` cannot be accessed on `WidgetBinding` because it is potentially null.

Screenshots

image

Checklist

  • [X] I signed the [CLA].
  • [X] I listed at least one issue that this PR fixes in the description above.
  • [ ] I updated/added relevant documentation (doc comments with ///).
  • [ ] I added new tests to check the change I am making].
  • [ ] All existing and new tests are passing.

guillempuche avatar Aug 11 '22 07:08 guillempuche

This problem is quite tricky since Flutter 3.0 changed the instance property from nullable to non-nullable. Therefore, your change will cause problems for Flutter 3.0.

jenshor avatar Aug 17 '22 11:08 jenshor

Then, could you change the CHANGELOG to reflect when this was changed and explain the requirements (we need Flutter 3) on the main documentation?

guillempuche avatar Aug 17 '22 18:08 guillempuche

Widgetbook next stable release will not support Flutter 2.0.

yousinix avatar May 22 '23 12:05 yousinix