• +94712452807
  • pubudu2013101@gmail.com
  • No 39, 2nd Lane, Dikhenapura, Horana
Flutter 2.2:  All new features you need to know

Flutter 2.2: All new features you need to know

Google introduced the new flutter 2.2 in their Google I/O event last month. They have introduced many more features to flutter with this release, including SDK for google payment and google ads. Not only that, they have released a new version of dart language, which is dart 2.13 that supports null safety. Let us talk about those brand new features today. 

Before we start, If you don’t know who I am, you are welcomed to my personal blog DevPubba.com.

Dart 2.13 released with flutter

Dart 2.13 expands support for native interoperability, with support for arrays and packed structs in FFI. It also includes support for type aliases, null safety, increasing readability and providing a gentle pathway for certain refactoring scenarios.

Null safety 

What is exactly null safety means. Let’s understand it first. 

As you can see, the following variable can never be null with the new dart null-safe. Because of that, if you assign null values to those variables, You’ll probably see warnings from the Dart analyzer

var i = 42; 
String name = getFileName();
final b = Foo();
// you will see a warning for the below code line
var i = null;

but, what if we need to allow null values for special cases. then you can let the dart analyzer know that you are allowing null values to that variable using syntax ?

void main() {
  int? a;
  a = null;
  print('a is $a.');

So, as you can see, unless you explicitly tell Dart that a variable can be null, it’s considered non-nullable. 

Type aliases

Type aliases is a new feature in the 2.13 language. Using a type alias, you can create a new name for any existing type, which can then be used anywhere the original type could be used. You aren’t really defining a new type, just introducing a short-hand alias. The alias even passes type equality tests

typedef Integer = int;
void main() {
  print(int == Integer); // true

So what can you use type aliases for? One common use is to give a shorter or more descriptive name to a type, making your code more readable and maintainable.

DevTools suite

Let’s see what you can do with the new flutter dev tool suite.

  • Inspect the UI layout and state of a Flutter app.
  • Diagnose UI jank performance issues in an app.
  • CPU profiling.
  • Network profiling for an app.
  • Source-level debugging.
  • Debug memory issues in a Flutter or Dart command-line app.
  • View general log and diagnostics information about a running Flutter or Dart command-line app.
  • Analyze code and app size.

I’ll be writing a separate article regarding flutter dev tools soon.

background caching using service workers

A service worker is an event-driven worker registered against an origin and a path. It takes the form of a JavaScript file that can control the web page/site it is associated with, intercepting and modifying navigation and resource requests, and caching resources in a very granular fashion to give you complete control over how your app behaves in certain situations (the most obvious one being when the network is not available.)

Monetization apps with flutter

The new Google mobile ads SDK for the flutter beta version is released now. 

The Google Mobile Ads SDK for Flutter currently supports loading and displaying banner, interstitial (full-screen), native ads, and rewarded video ads. Now you can Integrate Google mobile ads with your flutter app.

You can find the documentation here.

Google pay and Apple pay support for flutter. 

They introduce a new payment plugin for flutter that they build in partnership with the Goole pay team, which lets you pay for physical goods on both ios and android devices. 

If you are interested in learning Google sign in with flutter, please read about How to implement Google sign in with flutter within 10 min

Follow me on medium ..!!

#customauthentication #Docker #flutter #flutter2.2 #google #googleauthentication #Intellij #java #Javascript #Microservices #mobileappdevelopment #Oauth2 #React.js #React.Memo #ReactHooks #remotedebug #SprintBoot #tomcat #useEffect #useLayoutEffect #weblogic #weblogic12c #WorkFromHome android apps driving-licence DrivingExam flutter learners LearnesEka react.js reacthooks Sri-Lankan Sri-lankan-driving-exam Sri_Lankan useMemo useQuery useTranslations WordPress wordreminder

9 thoughts on “Flutter 2.2: All new features you need to know

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: