New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null safety #211
Null safety #211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lielb100 for making this contribution. You have done a great job. Let me know if you are done with all required changes. Once you done I'll review the PR and let you know if something still needs to be change.
Sorry it talk long, but it's done and ready to be reviewd, I'd be happy to help with further devolopment of the app.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lielb100 I have added some comments pls check these.
|
||
NotificationModel.fromJson(String tweetId, Map<dynamic, dynamic> map) { | ||
this.id = tweetId; | ||
id = tweetId; | ||
final data = json.decode(json.encode(map["data"])) as Map<String, dynamic>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting below error during app start.
Unhandled Exception: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast
cprint(e, errorIn: "On onMessageOpenedApp"); | ||
} | ||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage? event) { | ||
if (event != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have of add null check condition for event.data. There are some cases where event.data occured to be null value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event.data is a non nullable String, I don't think it's possible for it to be null.
await remoteConfig.fetchAndActivate(); | ||
// await remoteConfig. | ||
var data = remoteConfig.getString('FcmServerKey'); | ||
if (data != null && data.isNotEmpty) { | ||
if (data.isNotEmpty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add data null check condition. If FcmServerKey
is not available in firebase remote config then it'll retun null value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data is a non nullable String, I don't think it's possible for it to be null.
await remoteConfig.fetchAndActivate(); | ||
// await remoteConfig.activateFetched(); | ||
var data = remoteConfig.getString('appVersion'); | ||
if (data != null && data.isNotEmpty) { | ||
if (data.isNotEmpty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null check condition for data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data is a non nullable String, I don't think it's possible for it to be null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lielb100 for making this contribution.
Upgrade to Flutter SDK 2.12.0 sound null safety
I spent a lot of time and made the whole repo null safe, to make it more modern and future-proof.
Also I linted all the code with these analysis rules:
Suggesting to add a new branch for null_safety, and merge it when it is 100% stable.
Packages
flutter_link_preview
didn't have a null safe version so I replaced itflutter_link_previewer
new link preview packageflutter_chat_types
forPreviewData
typetranslator
for tweet translation