Hello Flutter Fellows, today we will see How to update Flutter 2.0. We all were waiting for Upgrading Flutter 2.0 and Flutter has now come up with Flutter 2.0 on March 30, 2021. It has many features and fixes that the previous version was having. Let us know about the new features and fixes of flutter 2.0.
It is better to see the video side by side
Highlights of Flutter 2.0:
Flutter Web -
Flutter’s web support has changed from beta to steady channel. With this stable delivery, Flutter pushes the reusability of code to the next level with the support of the web platform. Instead of an HTML renderer, Flutter added a new CanvasKit-based renderer. We’ve also added web-explicit highlights, such as a Link widget, to ensure your application running in the program feels like a web application.
Sound Null Safety –
Sound null safety strengthens the sort framework by recognizing nullable sorts from non-nullable sorts. This empowers developers to forestall invalid blunder crashes, a typical justification application to crash. With this feature, we can prevent crashes of our application on production. Combining the null checks into the system type which are caught while the development.
For additional desktop-specific functionality, this release enables command-line argument handling for Flutter apps. So that basic things like double-clicking on a data file in the Windows File Explorer can be used to open the file in the app. Flutter has also worked hard to make resizing much flexible for both Windows and macOS, and to allowed IME (Input Method Editors) for international users.
Platform Adaptive Apps: Flutter Folio Sample –
Now that Flutter supports three platforms for production apps like Android, iOS, and the web and three more in beta (Windows, macOS, and Linux), a natural question comes ahead of that: how we write an app that adjusts itself well to multiple different form factors (small, medium, and large screens), different input methods (touch, keyboard, and mouse) and different devices (mobile, web, and desktop)? To answer this question Flutter commissioned the Flutter Folio scrapbooking app.
Folio is meant to be a basic example of an app that would run well on multiple platforms from a single code base
Google Mobile Ads to Beta –
Google Mobile Ads SDK for Flutter is a brand-new plugin that provides inline banner and native ads, in addition to the existing overlay formats. This plugin combines support for Ad Manager and Admob, so it doesn’t matter what size publisher is user, this plugin can be adjusted to your situation.
New iOS features –
A few iOS widgets have been added to the Cupertino design language implementation for a better look and feel.
New CupertinoSearchTextField gives the iOS search bar UI. In addition to the highlighted work for iOS, Flutter is continuing to research performance improvements for iOS and Flutter in general when it comes to shaders and animation widgets.
New widgets: Autocomplete and ScaffoldMessenger –
Two additional new widgets:
— AutocompleteCore — It represents the minimal functionality required to get auto-complete functionality into your Flutter app.
— ScaffoldMessenger — It was created to deal with a number of SnackBar-related issues, including the ability to easily create a SnackBar in response to an AppBar action, creating SnackBars to keeps between Scaffold transitions, and being able to display SnackBars at the completion of an asynchronous action, even if the user has directed to a page with a different Scaffold.
Multiple Flutter instances with Add-to-App –
This feature is called Add-to-App, is the smartest way to reuse Flutter code on both mobile platforms while still preserving the existing native codebase.
Flutter Fix –
Flutter Fix is a combination of a lot of things. Firstly, there’s a new command-line option to the dart CLI tool called dart fix that. It knows where to look for a list of deprecated APIs and how to update code using those APIs. Secondly, it’s the list of available fixes itself, which is combined with the Flutter SDK as of version 2. And finally, it’s an updated set of Flutter extensions for the VS Code, IntelliJ, and Android Studio IDEs that know how to expose that same list of available fixes as quick fixes with little light bulbs that will help you to change the code with a click of a mouse.
Flutter DevTools –
Flutter DevTools is a tool is used for debugging Flutter apps, Flutter has renamed it to be Flutter DevTools when it’s debugging a Flutter app. Once you’ve got DevTools running, new error badges on the tabs help us to track down specific issues in our app. Another new feature in DevTools is the ability to easily see an image that’s has a higher resolution than it’s displayed, which helps track down extra app size and memory usage. To enable this feature, enable the Invert Oversized Images in the Flutter Inspector.
However, to upgrade the Flutter 2.0 you have to follow the below steps:
- Go to your Flutter SDK folder.
— Then open the flutter_console.bat file
— After that, type $flutter doctor command.
— If the $flutter doctor command executes with proper signal
— Then type the $flutter upgrade command.
This command will start downloading the upgrading version of Flutter that is Flutter 2.0. You will see the below result when it updates Flutter 2.0 successfully.