What can be better news than that your one-time written code can work in 5 different operating systems – Android, iOS, macOs, Windows and Linux, and even with the web. In a recent time, Flutter announced its 2.0 release in an event named “Flutter Engage”. This Release includes many exciting changes which make sure that Flutter is all set (stable for web) to go beyond mobile app development.
Let’s dig deep into the changes we got in the new version.
Web gets stable tag
Flutter wb channel is now stable (News of the year). From now, if you are working on a stable channel then your project is all ready to hit web support. Flutter for web focusing on –
- Performance –
To improve performance, Flutter introduced us to CanvasKit, a powered rendering engine that enables rendering Skia paint commands in the browser using WebAssembly and WebGL. Flutter is supporting both HTML renderer and CanvasKit renderer. By default rendering mode is set to auto which means that your app will render using HTML renderer on a mobile browser and CanvasKit renderer on a desktop browser.
- Web-specific features –
Flutter added support for custom URL strategies, by which users can reach your application via a click of a URL. Flutter also added a Link class, a widget that renders a real link on the web and uses WebViews in native platforms to open links. So, now you can create hyperLink as you did with HTML. Text selection is also improved, By the help of SelectableText and EditableText widgets your text can be selected, copied, and pasted.
- Plugin ecosystem –
You can bring your existing Flutter app to the web because Flutter web support is added in most-used flutter plugins like image_picker, google_map, firebase_analytics, firebase_storage, and many more.
What can be easier for developers than to know their errors which can cause an apps crash during development? Null safety stops null error crashes. Sound null safety is fully supported in stable as of Flutter 2, which contains Dart 2.12. Currently, most of all packages are already shifted to null safety. When an app uses a package that does not use null safety, the app runs in the unsound null safety mode.
The pub.dev package repository already has more than 1,000 null safe packages published which includes packages by the Dart, Flutter, Firebase, and Material teams.
In this release, Flutter also announced Desktop support (macOS, Windows, Linux) in a stable channel under an early release flag. The final stable version will be announced by the end of this year.
Native experience is the key feature of any cross-platform and to provide this to a certain level there are some improvements in widgets and input mechanisms. Flutter is suggesting to stick to beta or dev channels if we want to get regular updates and bug fixings.
New iOS features
Flutter also adds many widgets which gives a real feel of iOS apps.
The brand new CupertinoSearchTextField provides iOS search bar UI.
The CupertinoFormSection, CupertinoFormRow, and CupertinoTextFormFieldRow widgets are all set to produce validate form fields with iOS’s sectioned visual aesthetics.
Latest widgets: Autocomplete and ScaffoldMessenger
Flutter 2.0 includes two brand new widgets AutocompleteCore and the ScaffoldMessenger which are the most requested widgets.
Autocomplete functionality is easily implemented with minimum lines of code.
On other hand, ScaffoldMessenger is added to solve issues related to snackbar and to create snackbar easily when the user navigates to another screen with different scaffold and can display snackbar on completion of any asynchronous task. This can be done with only a few lines of code:-
final messenger = ScaffoldMessenger.of(context);
messenger.showSnackBar(SnackBar(content: Text(‘This is first snackbar.’)));
Improvements to Flutter DevTools
There are some more addition
- Error badges on tabs that can solve specific issues.
- DevTool will track images with higher resolution by which we can keep track of app size and memory usage. To use this feature, you have to enable Invert Oversized Images in the Flutter Inspector which will display images with high resolution upside-down so that you can easily find particular images.
- Display failed network call in-network profiler with red error labels.
- Include search and filter functionality in the Logging tab
These are just a few updates, there are still many other changes.
You can go through the following for more updates.
These wide varieties of changes make Flutter 2.0 very valuable and important. In a very short period of time Flutter closed 24,541 issues and merged 17,039 PRs from 765 contributors which is a very huge success. If you haven’t tested Flutter yet then I suggest this is the best time to do it now because targeting many platforms is now an easy task to do.
Happy Coding 🙂