Use a non null saftey package inside a null saftey enabled app dart
Solution 1
So, in case your app depends on some packages which don't have null safety. You can run your app with unsound null safety. For that run this command.
flutter run --no-sound-null-safety
For dart files :
dart --no-sound-null-safety run
So , what basically this does is runs some of your code with null safety and the part that is not eligible for null safety without null safety.
Reference from this article
Solution 2
You should not use non null-safe packages in a null safe app.
-
You can try to migrate it yourself (clone the repo, make the changes, etc...)
-
I've checked github_sign_in's github repo and found that there's a pending pull request with null-safety.
That request goes from this repository which is null-safe.
You can use it (at your own risk) instead of the original one:
dependencies:
github_sign_in:
git:
https://github.com/Gene-Dana/dart-github-sign-in
PS. Note that it does not support Flutter Web (as from the comments).
Farhan Syedain
Updated on December 31, 2022Comments
-
Farhan Syedain over 1 year
So , there is this package which doesn't have null safety in any of its versions. Is there any way i can use it inside my project where i am using null safety.
-
Jitesh Mohite almost 3 yearsheve you pubspec fro the specific lib, maybe you need to upgrade version.
-
Farhan Syedain almost 3 yearsThere is no null-safety version available
-
Jitesh Mohite almost 3 yearsthen update pubspec lib version, it should work
-
-
Farhan Syedain almost 3 yearsthanks, but actually i found another solution.
-
Arijeet almost 3 yearsCan you tell us about that solution of yours ?