What’s New in Dart 2.3?
Hybrid mobile applications came into existence in 2011 with the signature products, namely Xamarin SDK with C#, which this platform revolutionary, since then. After this, many hybrid mobile applications were introduced in the market to ease the lives of coders to write one code for many platforms.
Later, Google turns to put its finger in the pie with Flutter! In the year 2017, Google released it’s first-ever Flutter 1.0 version, after keeping it in beta mode for 18 months.
What is Dart?
Dart is a programming language used for coding apps in Flutter, which is also considered as another product by Google released in the same year.
With the evolving trends, it is important that companies update and offer something new to their users to maintain that spark in the relationship. That’s what Google did by upgrading Dart and recently released Dart 2.3!
This actually comes with a new set of new changes in the library as well as language. However, Google entirely focused on the Collections part with an aim to make Collections more expressive and declarative.
How to explore these new features and changes in Dart 2.3?
Here’s the list of significant changes in the Dart 2.3, in brief:
1. The Spread operator (…)
As per the image, consider the following list of text widgets.
Earlier, when you have to add all these to a ROW widget, you normally do something like this:
The issue with this technique was that if you wanted to add Asian countries first and then add North American countries, you would have to first include Asian countries in a row, somewhat like this:
This ultimately demands you to reorder the Addall methods to your list, which is not convincing and ideal at all.
But now, enter the new Spread operator to achieve the above results seamlessly:
Further, this can be simply reordered like so:
2. Utilizing “if” in a Collection
The all-new Dart 2.3 enables you to utilize if/else statements in Collection literals without any hassle. For example, look at the following “pre-Dart 2.3” image where we put on view Asian countries, only if the user is exactly from an Asian country:
But with the new version of Dart this how you could go about doing things:
This makes content more readable and clear for every flutter development company.
3. Utilizing “for” in a collection
Suppose you want to revise your “European countries list” before utilizing the list anywhere. To exhibit the new Dart feature, let’s just prepend “new” before all the countries. Things were something like this before Dart 2.3 arrived to take this step:
And this how you will do in all new Dart 2.3:
There are some more changes in the tool aspect of Dart 2.3, let’s take a look at them as well:
- Twists set literal formatting to follow other collection literals
- Add support for “UI code” features
- Accurately formats irregular commas in assertions
- Improve serration of adjoining strings in argument lists
The linter is updated to 1.0.86 that includes the following changes:
- Added the following lines: prefer_inlined_adds, prefer_if_elements_to_conditional_expressions, prefer_for_elements_to_map_fromIterable, diagnostic_describe_all_properties.
- Updated “file names” to omit prefixed extension Dart files
- Fixes false positives in “unnecessary parenthesis”
- Added a Changelog validator that grumbles if you “pub publish” without mentioning the up-to-date version
- Eliminated validation of library names when doing “pub publish”
- Added support for “pub goal activate” package from a custom pub URL
- Added subcommand: “pub logout” that log you out of the current session
Primary support for compiling Dart apps to native machine code has been added and two new tools have been added to “Bin” folder of the Dart SDK:
- “Dart2aot”: AOT (ahead of time) compiles a Dart program to native machine code and also runs on Windows, MacOs, and Linux.
- “Dartaotruntime”: It is a small run time used for performing an AOT compiled program.
These are some of the prominent changes and features introduced by Google in Dart 2.3. However, if you are planning to hire Flutter app developers for your business, then your search ends here! We at Concetto Labs company offers a wide range of app development services worldwide, enabling you to focus on core business aspects. For more details, you can visit our website: www.concettolabs.com