What’s New in Flutter 2.2 – Key Updates and Features
Flutter 2.2 brings extensive performance, stability, and feature improvements across iOS, Android, web, and desktop, including Dart 2.13 type aliases, service‑worker enhancements, new Material icons, platform‑adaptive guidance, deferred components, Windows UWP support, and a host of ecosystem and tooling updates, all backed by thousands of merged PRs and community contributions.
Flutter 2.2 focuses on polishing and optimizing the framework, engine, and plugin ecosystem, delivering performance improvements for iOS ( iOS的性能改进) and Android ( Android的延迟组件), as well as service‑worker updates for Flutter web.
Developers can upgrade by switching to the stable channel or following the installation guide at flutter.dev/docs/get‑st…. The release merges 2,456 PRs and closes 3,105 issues, with top contributors highlighted.
Flutter 2.2 Stable Updates
This version adds new Material icons, TextSpan text handling, scrollbar behavior, and mouse‑cursor support, all built on the new Dart version.
Dart 2.13
Dart 2.13 introduces type aliases for functions and classes, and a deprecation‑based class rename mechanism.
typedef ValueChanged<T> = void Function(T value);
typedef StringList = List<String>;
@Deprecated("Use NewClassName instead")
typedef OldClassName<T> = NewClassName<T>;To enable type aliases, set the SDK constraint in pubspec to ">=2.13.0 <3.0.0".
environment:
sdk: ">=2.13.0 <3.0.0"Flutter Web Updates
The new service worker improves caching and prevents duplicate main.dart.js downloads. Enabling it requires regenerating index.html via flutter create.
Web rendering improvements include FontFeature support, Canvas API text rendering, and added ShaderMask and computeLineMetrics for both HTML and CanvasKit.
Accessibility enhancements introduce a SemanticsNode tree that maps to the DOM, with improved focus handling for transformed widgets.
$ flutter run -d chrome --profile \
--dart-define=FLUTTER_WEB_DEBUG_SHOW_SEMANTICS=trueiOS Page Transitions and Incremental Installation
Rendering time for iOS page transitions is reduced by 75%, and incremental iOS installs cut update installation time by 40%.
Platform‑Adaptive Applications
Guidance for building apps that adapt to multiple platforms, input types, and navigation patterns is provided, with examples like Flokk and Folio.
More Material Icons
Two PRs add over 7,000 Material icons, searchable at fonts.google.com/icons.
Improved Text Handling
Custom text actions allow special handling of keys such as Enter, Ctrl+Enter, and backspace. Example code demonstrates clearing a TextField with custom shortcuts.
import 'package:flutter/material.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Flutter Text Editing Fun',
home: HomePage(),
);
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
body: Column(
children: [
TextField(),
OutlinedButton(onPressed: () {}, child: const Text('Press Me')),
],
),
);
}Further examples show binding delete, backspace, and left‑arrow keys to a custom ClearIntent action.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Flutter TextField Key Binding Demo',
home: Scaffold(body: UnforgivingTextField()),
);
}
class UnforgivingTextField extends StatefulWidget {
@override
State<UnforgivingTextField> createState() => _UnforgivingTextFieldState();
}
class _UnforgivingTextFieldState extends State<UnforgivingTextField> {
late TextEditingController controller;
@override
void initState() {
super.initState();
controller = TextEditingController();
}
@override
Widget build(BuildContext context) => Shortcuts(
shortcuts: {
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const ClearIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const ClearIntent(),
LogicalKeySet(LogicalKeyboardKey.backspace): const ClearIntent(),
},
child: Actions(
actions: {ClearIntent: ClearAction(controller: controller)},
child: Center(child: TextField(controller: controller)),
),
);
}
class ClearIntent extends Intent { const ClearIntent(); }
class ClearAction extends Action<ClearIntent> {
ClearAction({required this.controller});
final TextEditingController controller;
@override
Object? invoke(covariant ClearIntent intent) => controller.clear();
}Automatic Scrollbar Behavior
Scrollbars now appear automatically on desktop when needed; developers can customize via ScrollBarTheme or ScrollBehavior.
Mouse Cursor on TextSpan
TextSpans with gesture recognizers now automatically show a pointer cursor, and support onEnter, onExit, and mouseCursor.
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart' as urlLauncher;
void main() => runApp(App());
class App extends StatelessWidget {
static const title = 'Flutter App';
@override
Widget build(BuildContext context) => MaterialApp(
title: title,
home: HomePage(),
);
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: Text(App.title)),
body: Center(
child: RichText(
text: TextSpan(
style: TextStyle(fontSize: 48),
children: [
TextSpan(text: 'This is not a link, ', style: TextStyle(color: Colors.black)),
TextSpan(
text: 'but this is',
style: TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer()
..onTap = () => urlLauncher.launch('https://flutter.dev'),
),
],
),
),
),
);
}Preview Features in Flutter 2.2
Includes iOS shader‑compiler performance improvements, Android deferred components, desktop updates, and ARM64 Linux host support.
iOS Shader‑Compilation Improvements
Pre‑warming shaders for Metal reduces jank, though it increases app size and startup latency.
Android Deferred Components
Allows downloading code and assets on demand, reducing initial install size (e.g., a 46% reduction in Flutter Gallery).
Flutter Windows UWP Alpha
Enables building Flutter apps for Windows UWP, including Xbox, via the dev channel.
$ flutter channel dev
$ flutter upgrade
$ flutter config --enable-windows-uwp-desktop $ flutter create uwp_fun
$ cd uwp_fun
$ flutter pub get
$ flutter run -d winuwpARM64 Linux Support
Contributed by Sony engineer Hidenori Matsubayashi, allowing Flutter builds on ARM64 Linux machines.
Ecosystem and Tooling Updates
Flutter Favorite now includes 24 new plugins, many migrated to null safety. FlutterFire adds Firebase App Check support and type‑safe APIs. DevTools gains memory‑tracking improvements and a new Provider tab. IDE plugins for VS Code and Android Studio receive refactoring and stack‑trace features. DartPad introduces a guided workshop UI.
Community Focus: FlutterFlow
FlutterFlow is a low‑code, web‑based design tool that outputs Flutter code and integrates with Firebase.
Breaking Changes
Removed deprecated binary messages ( BinaryMessages) and the TypeMatcher class.
Summary
The Flutter team thanks the community for the continued growth, noting that over one‑eighth of new Play Store apps are built with Flutter, with more than 200,000 Flutter apps already published.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
