marcglasberg / back_button_interceptor

Flutter Package: May be used to intercept the Android back-button, as an alternative to `WillPopScope`.
BSD 2-Clause "Simplified" License
105 stars 21 forks source link

Version 6.0.0 causes an error when the Dart SDK version is less than 1.17.0 #21

Closed yukisakai1225 closed 2 years ago

yukisakai1225 commented 2 years ago

WidgetsBinding.instance was changed to non-nullable in flutter3.0. So, if the Dart SDK is less than 2.17.0, it will be treated as nullable. Therefore Version 6.0.0 only supports Dart SDK 2.17.0 or higher. I'm not good at English, so it may be hard to read, but thanks in advance.

Lorenzohidalgo commented 2 years ago

I can also confirm that the interceptor doesn't work correctly in my app after upgrading to flutter 3 and v6.0.0 in a non null-safe app.

marcglasberg commented 2 years ago

Yes, if you are using Flutter <3.0 or non nullsafe app, please fix it to version 5.1.0.

I have upgraded the app to 6.0.1 and changed the environment to sdk: '>=2.17.0 <3.0.0'

Lorenzohidalgo commented 2 years ago

@marcglasberg, I'm currently running Flutter 3.0.3 but a null-safe app. Running it on 5.1.0 does return errors while building the app. Is there a version compatible with flutter 3 but non-nullsafe?

marcglasberg commented 2 years ago

@Lorenzohidalgo Sorry, it's not practical to keep supporting non-nullsafe apps. I suggest you upgrade your app to nullsafe, or that you keep using an older version of Flutter. Another alternative is for you to fork the repo, apply your changes, and then link your pubspec.yaml directly to your Git.