Upgrade My Projects to Flutter 2.0 Experience And It Suprises Me
Hi all, this post I'm gonna share what I encounter when upgrading the project to flutter. Especially this app Food Today. That's been around 1 years in App Store and Play Store. The app helps people to capture moment with their daily foods so they can control it as food diary. Other than that there's food holiday everyday that will inspire you to eat what foods for today. Still a lot of features that you can get. Just try it.
I have an issue on iOS where I need to update my pod file to make platform :ios, '11.0'. Before It's 9.0, I think now 9.0 is deprecated and we can't use it anymore for the next updated plugin. Like I used a lot firebase feature. And so thare are coding adjusment that will break your code that you need to read the their docs. But usually there's error message in console about proper way to solve it.
Now like snackbar from flutter need to be changed according to the new one, https://flutter.dev/docs/release/breaking-changes/scaffold-messenger. Fortunely there's a doc from flutter to update it. For my self it's not hard to update the changes, but more like time consuming to replace it one by one. But for better app we need to transform it. So it's no problem in the end. We use it free lol.
Next, I got so many error dependecies like these, it's quite painful for me to check it one by one. The fix is to update the plugin version to the latest one. Every thing that's breaking need to be updated if not your app will never run in this new flutter. For me, it takes almost two days to update and check it if it's work or not. And sadly there's a library that i need to change because it's not updated yet. The plugin is for google admob, before I don't use the official one because it doesn't support banner widget and now it supports it. So I need to change it as well, quite painful. But hope the old issue doesn't happen again that's crash when opening the page that has admob.
After that I need to solve many errors regarding changing plugin has made. Not only that there anre many class that's deprecated like FlatButton, RaiseButton, etc. The migration docs for button is in here. You need to adapt new style for the button that I think it looks good.
Another thing the apple_sign_in package that's not updated from the dev. In github it says the package is no longer updated again. So it's shock me first how can I update to null-safety feature if one of the plugin is not null-safely. Luckily after I read discussion in github there's someone that made it null-safety with different plugin name. It's called the_apple_sign_in package you can search in google. Or I share it here https://pub.dev/packages/the_apple_sign_in.
One thing more is you need to check every plugins is null-safety to use the null-safety feature in your code. You need to use this one to check it dart pub outdated --mode=null-safety. The full guideline in here https://dart.dev/null-safety/migration-guide.
There's another plugin called flushbar that I used to show toast message like android where the developer doesn't update again the plugin in github. So luckily there's someone who make it null safety so I can still use the plugin. The plugin called another_flushbar you can see it here https://pub.dev/packages/another_flushbar.
If you need to use null-safety in your code. you need to update your sdk version to as well. I got this info from this stackoverflow answer and it works https://stackoverflow.com/a/65117431. You'll get suprised because there are lot of errors will happen in your code that you need to solve it again.
I think that's all my experience when upgrading my project to flutter 2 or null-safety. As developer we need to adapt in new technology or new update from anything. Make it like hobby to spend and share it with others so it can benefit to others as well.
And sorry if my grammar is not good, I still learn it but I hope you get my point. Thanks for visiting my simple blog by Ungapps. It's been a many years to write this blog. And I hope I can continue it again and again.