Connect with us

Articles

What’s new in Flutter 3.0 in brief for lazies

Flutter 3 may seem like a little milestone but It is not! Let me explain the highlight changes in brief!

First of all Flutter 3.0 uses Dart 2.17 so which means we have;

Dart 2.17

Enhanced enums with members

enums can use magic inside now!

enum Water {
  frozen(32),
  lukewarm(100),
  boiling(212);

  final int tempInFahrenheit;
  const Water(this.tempInFahrenheit);

  @override
  String toString() => "The $name water is $tempInFahrenheit F.";
}

// USAGE
print(Water.frozen); // prints "The frozen water is 32 F."

Super parameters

Super parameters are much more readable now!

class Citizen {
  String? id;
  Citizen({this.id});
}

// OLD WAY
class Female extends Citizen {
  String? name;
  Female({this.name, String? id}) : super(id: id);
}

// NEW WAY
class Male extends Citizen {
  String? name;
  Male({this.name, super.id});
}

Named args everywhere:

You can define your named parameters wherever you want!!

class Citizen {
  String id;
  String name;
  Citizen(this.name, {required this.id});
}

// OLD WAY
Citizen('name', id:'id'); // VALID
Citizen(id:'id','name'); // ERROR

// NEW WAY
Citizen('name', id:'id'); // VALID
Citizen(id:'id','name'); // VALID

We can take a look at Flutter 3.0 now!!

Flutter 3.0

  • Linux and macOS have reached the stable branch
  • Fully supports Material Design 3 now!
  • Casual Games Toolkit is launched to make it easier for casual game developers to get started, (It’s basically a starter kit of templates and best practices along with credits for ads and cloud services)
  • We have Happy paths now!! (It’s a documentation guide to developing more advanced apps)
  • Flutter is fully native on M1 now!!! That gives us a much faster compilation
  • macOS desktop apps are built in default as universal binaries, with native support for both existing Intel-based and M1 Macs.
  • Flutter/Firebase integration is a fully-supported. (Also FlutterFire is moved to Firebase Official Documentation website and also its repo as well)
  • flutter_lints package updated to v2.0
  • Much better ads support and better performance on android without any breaking changes!
  • The Performance best practices page has largely been rewritten and moved to be more visible.
  • More theme extensions to make our life easier now! example code
  • Full support for international text input on all desktop platforms (including Chinese, Japanese, and Korean)
  • The flutter team will provide limited support on Windows 7/8 for DEVELOPMENT (not for apps) from now on. (not deprecated but deprecating so they highly suggest you upgrade your win)
  • Foldable phone support. (MediaQuery now contains a list of DisplayFeatures, describing the bounds and states of device elements like hinges, folds, and cutouts.)
  • Flutter web app has a new lifecycle API and It gives us the flexibility to control the bootstrap process of your Flutter app from the hosting HTML page and helps Lighthouse analyze the performance of your app.
  • iOS releases simplified with new ipa commands
    flutter build ipa —-export-method ad-hoc / development / enterprise
    Once the app bundle is built, upload it to Apple through the Apple Transport macOS app or on the command line using xcrun altool
    In this way, you will no longer need to open Xcode to release your app anymore!!
  • Support of 32-bit iOS/iOS 9/iOS 10 is almost done
  • Cascading menus and support for the macOS system menu bar

One more thing in Flutter 3.0

Performance improvements

  • Partial repaint when there is a single rectangular dirty region is now enabled on both iOS and newer Android devices.
  • Performance improvements of opacity animations in simple cases. (still working on that it will get better and better in time)
  • Flutter now supports variable refresh rates on iOS devices with ProMotion displays, Flutter apps can render at refresh rates reaching 120 Hz, which were previously limited to 60 Hz.
  • Raster and UI threads now run at a higher priority on Android and iOS than other threads; for example, Dart VM background garbage collection threads. In our benchmarks, this resulted in ~20% faster average frame build times.
  • We have a new caching mechanism that estimates the rendering complexity of pictures based on the cost of draw operations that it contains. which gives us reduced memory usage without losing any performance

  • Flutter web now uses the ImageDecoder API in browsers that support it. That basically gives us 2x faster image decoding, and It never blocks the main thread, removing all jank that was previously caused by images.
  • Impeller is a new solution to address early-onset jank on iOS and other platforms. Impeller precompiles a smaller, simpler set of shaders at engine build time so that they won’t compile while an app is running
    (It’s not production-ready and far from finished but It’s available on iOS.)
    To try it out;
    run flutter run —-enable-impeller
    or
    set FLTEnableImpeller to true in Info.plist

Full Article: Hasan Basri Bayat @ ITNEXT
👋: 161
May 13, 2022
Advertisement

Trending