Flutter, Google’s versatile UI toolkit, charted an extraordinary course in 2023 with four significant releases (3.7, 3.10, 3.13, 3.16). These releases introduced groundbreaking features and enhancements, reshaping the landscape of Flutter and empowering developers across mobile, web, and desktop platforms. In this article, our Senior Flutter Mobile Developer, Adam Stelmaszyk, attempts to describe some of the major features and improvements.
Material 3: An Aesthetic Evolution
Starting from Flutter version 3.10, Material 3 is set as the default Material for Flutter. Flutter provides a website where developers can experiment with Material 3 components. To observe the distinctions between Material 3 and Material 2, you can visit this link.
The visual characteristics of Material 3 components are mainly influenced by the values assigned to ThemeData.colorScheme and ThemeData.textTheme. To establish a Material 3 color scheme, it is recommended to utilize ColorScheme.fromSeed(), a method that generates both dark and light schemes that are visually appealing and compliant with accessibility contrast requirements. Another option is to create a color scheme based on the predominant colors in an image using ColorScheme.fromImageProvider.
To further tailor the appearance of Material 3 components, incorporate component themes into your ThemeData, such as ThemeData.segmentedButtonTheme or ThemeData.snackBarTheme. Any non-null properties in these component themes will override the defaults specified in the component’s API documentation.
When transitioning your app to Material 3 in Flutter, the majority of widgets can be upgraded seamlessly. However, certain widgets, such as NavigationBar, require manual code adjustments as entirely new implementations are necessary. Until your app is entirely updated, the UI might look or act a bit strange. For a list of entirely new Material components, refer to the Affected widgets page. For additional details, click here.
Flutter Impeller: Revolutionizing Rendering Performance
Flutter introduced Impeller, a revolutionary rendering engine aiming to resolve performance issues. Unlike traditional systems, Impeller precompiles shaders during the Flutter Engine build, eliminating runtime compilation and ensuring smooth animations.
Key Objectives of Impeller:
- Predictable performance: Impeller compiles all shaders and reflection offline at build time. It builds all pipeline state objects upfront. The engine controls caching and caches explicitly.
- Instrumentable: Impeller tags and labels all graphics resources like textures, and buffers. It can capture and persist animations to disk without affecting per-frame rendering performance.
- Portable: Flutter doesn’t tie Impeller to a specific client rendering API. You can author shaders once and convert them to backend-specific formats as necessary.
- Leverages modern graphics APIs: Impeller uses, but doesn’t depend on, features available in modern APIs like Metal and Vulkan.
- Leverages concurrency: Impeller can distribute single-frame workloads across multiple threads if necessary.
Availability: Impeller is enabled by default on iOS, available in preview for macOS (since Flutter 3.13), and accessible behind a flag on Android devices supporting Vulkan (as of Flutter 3.16).
In-Depth Exploration: Developers seeking a deeper understanding can refer to the Impeller documentation.
DevTools: Empowering Developers
Memory Analysis: DevTools introduces features such as:
- include the ability to analyze the current memory allocation for your app by class and memory type,
- investigate what code paths are allocating memory for a set of classes at runtime,
- diff memory snapshots to understand memory management between two points in time
All features from DevTools are documented here, so check out the documentation for more details.
Extensions Framework: DevTools now supports a new extensions framework, enabling package authors to build custom tools directly in DevTools. Dart and Flutter developers can access tools specific to their use cases based on app dependencies.
Discover More: Detailed insights and information about DevTools can be found here.
Internationalization Overhaul
It has been completely revamped! They have completely rewritten the gen-l10n tool to support:
- Descriptive syntax errors.
- Complex messages involving nested/multiple plurals, selects, and placeholders.
For more information visit the website.
SLSA Level 1 Security: Fortifying Flutter’s Foundations
The Flutter Framework has achieved compliance with Supply Chain Levels for Software Artifacts (SLSA) Level 1, as outlined by https://slsa.dev/. This attests to the successful implementation of numerous security enhancements, including:
- Scripted build process: The build scripts for Flutter now facilitate automated builds on trusted platforms. Constructing the framework on a secure architecture helps prevent tampering with artifacts, thereby enhancing the overall security of the supply chain.
- Multi-party approval with audit logging: The release workflows for Flutter undergo execution only after receiving approval from multiple engineers. Every execution generates auditable log records, ensuring that changes between source code and artifact generation are closely monitored and controlled.
- Provenance: Beta and stable releases now incorporate provenance, as detailed here. This signifies that framework release artifacts are built by trusted sources with expected contents. Each release provides links to view and verify the provenance on the SDK archive here.
Platform-Specific Updates
Web
Element Embedding: Before 2023, flutter apps could either fill the entire page body or display within an iframe tag. Flutter introduces enhanced flexibility for web developers, allowing Flutter apps to be embedded within specific elements on web pages. Learn more about embedding a Flutter app into an HTML page.
Shader Support: Web apps now leverage Flutter’s fragment shader support, providing enhanced graphics capabilities. Explore details about fragment shaders.
iOS
Wireless Debugging:
Flutter apps can now be run or hot-reloaded without the need for a cable. Following a successful wireless pairing of an iOS device in Xcode, developers can deploy the app to the device using the command “flutter run.”
Spellcheck Support:
The SpellCheckConfiguration() widget now defaults to supporting Apple’s spell check service on iOS. To utilize this widget, simply set it using the spellCheckConfiguration parameter in CupertinoTextField.
Expanded Resources:
The documentation now encompasses cross-platform design considerations for specific UI components, available here. For in-depth insights into each of these UI components, refer to the discussions here.
Android
CameraX Support: Flutter integrates preliminary support for CameraX, a Jetpack library, in the Flutter Camera plugin. This support includes image capture, video recording, and live camera preview functionalities.
Elevating Game Development
Casual Games Toolkit Update: Flutter unveils a significant update to its Casual Games Toolkit during the 3.13 release. The toolkit now includes genre-specific templates (e.g., card games, endless runners) and integrates services like Play Games Services, in-app purchases, ads, achievements, crashlytics, and multiplayer support.
Dive Deeper: Explore the Casual Games Toolkit and gain insights from the launch post by Zoey Fan on Medium.
Conclusion
Flutter’s dynamic journey in 2023 reflects its commitment to innovation and empowering developers across diverse platforms. As we move forward, Flutter continues to evolve, setting new benchmarks in the world of app development. Stay tuned for further advancements and explore the full spectrum of possibilities with Flutter.
Written by Adam Stelmaszyk