id
stringlengths
14
17
text
stringlengths
23
1.11k
source
stringlengths
35
114
096a1f8af131-7
Timeline Landed in version: 2.3.0-17.0.pre.1 In stable release: 2.5 References API documentation: TestDefaultBinaryMessenger TestDefaultBinaryMessengerBinding Relevant PRs: PR #76288: Migrate to ChannelBuffers.push
https://docs.flutter.dev/release/breaking-changes/mock-platform-channels/index.html
d5c17c138af5-0
MouseTracker moved to rendering Summary Context Description of change Migration guide Timeline References Summary MouseTracker and related symbols are moved from the gestures package, resulting in error messages such as undefined classes or methods. Import them from rendering package instead. Context Prior to this change MouseTracker was part of the gestures package. This brought troubles when we found out that code related to MouseTracker often wanted to import from the rendering package. Since MouseTracker turned out to be more connected to rendering than gestures, we have moved it and its related code to rendering. Description of change The file mouse_tracking.dart has been moved from the gestures package to rendering. All symbols in the said file have been moved without keeping backward compatibility. Migration guide
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-moved-to-rendering/index.html
d5c17c138af5-1
Migration guide If you see error of “Undefined class” or “Undefined name” of the following symbols: MouseDetectorAnnotationFinder MouseTracker MouseTrackerAnnotation PointerEnterEventListener PointerExitEventListener PointerHoverEventListener You should add the following import: import 'package:flutter/rendering.dart' Timeline Landed in version: 1.16.3 In stable release: 1.17 References API documentation: MouseDetectorAnnotationFinder MouseTracker MouseTrackerAnnotation PointerEnterEventListener PointerExitEventListener PointerHoverEventListener Relevant issues: Transform mouse events to the local coordinate system
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-moved-to-rendering/index.html
d5c17c138af5-2
Relevant issues: Transform mouse events to the local coordinate system Move annotations to a separate tree Relevant PR: Move mouse_tracking.dart to rendering
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-moved-to-rendering/index.html
f6e50b9841fc-0
MouseTracker no longer attaches annotations Summary Context Description of change Migration guide Timeline References Summary Removed MouseTracker’s methods attachAnnotation, detachAnnotation, and isAnnotationAttached. Context Mouse events, such as when a mouse pointer has entered a region, exited, or is hovering over a region, are detected with the help of MouseTrackerAnnotations that are placed on interested regions during the render phase. Upon each update (a new frame or a new event), MouseTracker compares the annotations hovered by the mouse pointer before and after the update, then dispatches callbacks accordingly. Issue #44631).
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
f6e50b9841fc-1
Issue #44631). This mechanism has been replaced by making MouseRegion a stateful widget, so that it can perform the mounted-exit check by itself by blocking the callback when unmounted. Therefore, these methods have been removed, and MouseTracker no longer tracks all annotations on the screen. Description of change The MouseTracker class has removed three methods related to attaching annotations: void attachAnnotation(MouseTrackerAnnotation annotation) {/* ... */} void detachAnnotation(MouseTrackerAnnotation annotation) {/* ... */} @visibleForTesting - bool isAnnotationAttached(MouseTrackerAnnotation annotation) {/* ... */} } RenderMouseRegion and MouseTrackerAnnotation no longer perform the mounted-exit check, while MouseRegion still does. Migration guide Calls to MouseTracker.attachAnnotation and detachAnnotation should be removed with little to no impact:
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
f6e50b9841fc-2
Uses of MouseRegion should not be affected at all. If your code directly uses RenderMouseRegion or MouseTrackerAnnotation, be aware that onExit is now called when the exit is caused by events that used to call MouseTracker.detachAnnotation. This should not be a problem if no states are involved, otherwise you might want to add the mounted-exit check, especially if the callback is leaked so that outer widgets might call setState in it. For example: Code before migration: class MyMouseRegion extends SingleChildRenderObjectWidget const MyMouseRegion ({ this onHoverChange }); final ValueChanged bool onHoverChange @override RenderMouseRegion createRenderObject
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
f6e50b9841fc-3
@override RenderMouseRegion createRenderObject BuildContext context return RenderMouseRegion onEnter: onHoverChange true ); }, onExit: onHoverChange false ); }, ); @override void updateRenderObject BuildContext context RenderMouseRegion renderObject renderObject onEnter onHoverChange true ); onExit onHoverChange false ); }; Code after migration:
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
f6e50b9841fc-4
); }; Code after migration: class MyMouseRegion extends SingleChildRenderObjectWidget const MyMouseRegion ({ this onHoverChange }); final ValueChanged bool onHoverChange @override RenderMouseRegion createRenderObject BuildContext context return RenderMouseRegion onEnter: onHoverChange true ); }, onExit: onHoverChange false ); }, ); @override
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
f6e50b9841fc-5
}, ); @override void updateRenderObject BuildContext context RenderMouseRegion renderObject renderObject onEnter onHoverChange true ); onExit onHoverChange false ); }; @override void didUnmountRenderObject RenderMouseRegion renderObject renderObject onExit onHoverChange == null null {};
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
f6e50b9841fc-6
== null null {}; Calls to MouseTracker.isAnnotationAttached must be removed. This feature is no longer technically possible, since annotations are no longer tracked. If you somehow need this feature, please submit an issue. Timeline Landed in version: 1.15.4 In stable release: 1.17 References API documentation: MouseRegion MouseTracker MouseTrackerAnnotation RenderMouseRegion Relevant PRs: MouseTracker no longer requires annotations attached, which made the change Improve MouseTracker lifecycle: Move checks to post-frame, which first introduced the mounted-exit change, explained at The change to onExit.
https://docs.flutter.dev/release/breaking-changes/mouse-tracker-no-longer-attaches-annotations/index.html
75f2dae7dca9-0
Insecure HTTP connections are disabled by default on iOS and Android Summary Context Migration guide Allowing cleartext connection for debug builds Additional Information Timeline References Summary If your code tries to open an HTTP connection to a host on iOS or Android, a StateException is now thrown with the following message: Use HTTPS instead. Important: This change over-restricted HTTP access on local networks beyond the restrictions imposed by mobile platforms (flutter/flutter#72723). This change has since been reverted. Context Starting with Android API 28 and iOS 9, these platforms disable insecure HTTP connections by default. With this change Flutter also disables insecure connections on mobile platforms. Other platforms (desktop, web, etc) are not affected.
https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android/index.html
75f2dae7dca9-1
You can override this behavior by following the platform-specific guidelines to define a domain-specific network policy. See the migration guide below for details. Much like the platforms, the application can still open insecure socket connections. Flutter does not enforce any policy at socket level; you would be responsible for securing the connection. Migration guide On iOS, you can add NSExceptionDomains to your application’s Info.plist. On Android, you can add a network security config XML. For Flutter to find your XML file, you need to also add a metadata entry to the <application> tag in your manifest. This metadata entry should carry the name: io.flutter.network-policy and should contain the resource identifier of the XML. For instance, if you put your XML configuration under res/xml/network_security_config.xml, your manifest would contain the following: Allowing cleartext connection for debug builds
https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android/index.html
75f2dae7dca9-2
Allowing cleartext connection for debug builds If you would like to allow HTTP connections for Android debug builds, you can add the following snippet to your $project_path\android\app\src\debug\AndroidManifest.xml: For iOS, you can follow these instructions to create a Info-debug.plist and put this in: We do not recommend you do this for your release builds. Additional Information Build time configuration is the only way to change network policy. It cannot be modified at runtime. Localhost connections are always allowed. You can allow insecure connections only to domains. Specific IP addresses are not accepted as input. This is in line with what platforms support. If you would like to allow IP addresses, the only option is to allow cleartext connections in your app. Timeline
https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android/index.html
75f2dae7dca9-3
Timeline Landed in version: 1.23 In stable release: 2.0.0 Reverted in version: 2.2.0 (proposed) References API documentation: There’s no API for this change since the modification to network policy is done through the platform specific configuration as detailed above. Relevant PRs: PR 20218: Plumbing for setting domain network policy Introduce per-domain policy for strict secure connections
https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android/index.html
d522403b7ad4-0
Removing Notification.visitAncestor Summary Context Description of change Migration guide Timeline References Summary Notifications are more efficient by traversing only ancestors that are notification listeners. Context The notification API traversed the element tree in order to locate a notification receiver. This led to some unfortunate performance characteristics: If there was no receiver for a given notification type, the entire element tree above the notification dispatch point would be traversed and type checked. For multiple notifications in a given frame (which is common for scroll views) we ended up traversing the element tree multiple times.
https://docs.flutter.dev/release/breaking-changes/notifications/index.html
d522403b7ad4-1
If there were multiple or nested scroll views on a given page, the situation was worsened significantly - each scroll view would dispatch multiple notifications per frame. For example, in the Dart/Flutter Devtools flamegraph page, we found that about 30% of CPU time was spent dispatching notifications. In order to reduce the cost of dispatching notifications, we have changed notification dispatch so that it only visits ancestors that are notification listeners, reducing the number of elements visited per frame. However, the old notification system exposed the fact that it traversed each element as part of its API via Notification.visitAncestor. This method is no longer supported as we no longer visit all ancestor elements. Description of change Notification.visitAncestor has been removed. Any classes that extend Notification should no longer override this method. * If you don’t implement a custom Notification that overrides Notification.visitAncestor, then no changes are required. **
https://docs.flutter.dev/release/breaking-changes/notifications/index.html
d522403b7ad4-2
Migration guide If you have a subclass of Notification that overrides Notification.visitAncestor, then you must either delete the override or opt-into old style notification dispatch with the following code. Code before migration: import 'package:flutter/widgets.dart' class MyNotification extends Notification @override bool visitAncestor Element element print 'Visiting $element ); return super visitAncestor element ); void methodThatSendsNotification BuildContext context MyNotification () dispatch
https://docs.flutter.dev/release/breaking-changes/notifications/index.html
d522403b7ad4-3
MyNotification () dispatch context ); Code after migration: import 'package:flutter/widgets.dart' class MyNotification extends Notification bool visitAncestor Element element print 'Visiting $element ); if element is ProxyElement final Widget widget element widget if widget is NotificationListener MyNotification >) return widget
https://docs.flutter.dev/release/breaking-changes/notifications/index.html
d522403b7ad4-4
>) return widget onNotification ?. call notification ?? true return true void methodThatSendsNotification BuildContext context context ?. visitAncestor MyNotification () visitAncestor ); Note that this performs poorly compared to the new default behavior of Notification.dispatch. Timeline Landed in version: 2.12.0-4.1 In stable release: 3.0.0 References API documentation: Relevant issues:
https://docs.flutter.dev/release/breaking-changes/notifications/index.html
d522403b7ad4-5
Relevant issues: Relevant PRs:
https://docs.flutter.dev/release/breaking-changes/notifications/index.html
c132b9ae0a59-0
Nullable CupertinoThemeData.brightness Summary Context Description of change Migration guide Timeline References Summary CupertinoThemeData.brightness is now nullable. Context CupertinoThemeData.brightness is now used to override MediaQuery.platformBrightness for Cupertino widgets. Before this change, the CupertinoThemeData.brightness getter returned Brightness.light when it was set to null. Description of change Previously CupertinoThemeData.brightness was implemented as a getter: Brightness get brightness _brightness ?? Brightness light final Brightness
https://docs.flutter.dev/release/breaking-changes/nullable-cupertinothemedata-brightness/index.html
c132b9ae0a59-1
light final Brightness _brightness It is now a stored property: final Brightness brightness Migration guide Generally CupertinoThemeData.brightness is rarely useful outside of the Flutter framework. To retrieve the brightness for Cupertino widgets, now use CupertinoTheme.brightnessOf instead. With this change, it is now possible to override CupertinoThemeData.brightness in a CupertinoThemeData subclass to change the brightness override. For example: class AwaysDarkCupertinoThemeData extends CupertinoThemeData Brightness brightness Brightness dark
https://docs.flutter.dev/release/breaking-changes/nullable-cupertinothemedata-brightness/index.html
c132b9ae0a59-2
brightness Brightness dark When a CupertinoTheme uses the above CupertinoThemeData, dark mode is enabled for all its Cupertino descendants that are affected by this CupertinoTheme. Timeline Landed in version: 1.16.3 In stable release: 1.17 References Design doc: Make CupertinoThemeData.brightness nullable API documentation: CupertinoThemeData.brightness Relevant issue: Issue 47255 Relevant PR: Let material ThemeData dictate brightness if cupertinoOverrideTheme.brightness is null
https://docs.flutter.dev/release/breaking-changes/nullable-cupertinothemedata-brightness/index.html
528e61eb3962-0
Rebuild optimization for OverlayEntries and Routes Summary Context Description of change Migration guide Timeline References Summary This optimization improves performance for route transitions, but it may uncover missing calls to setState in your app. Context Prior to this change, an OverlayEntry would rebuild when a new opaque entry was added on top of it or removed above it. These rebuilds were unnecessary because they were not triggered by a change in state of the affected OverlayEntry. This breaking change optimized how we handle the addition and removal of OverlayEntrys, and removes unnecessary rebuilds to improve performance. Description of change
https://docs.flutter.dev/release/breaking-changes/overlay-entry-rebuilds/index.html
528e61eb3962-1
Description of change In most cases, this change doesn’t require any changes to your code. However, if your app was erroneously relying on the implicit rebuilds you may see issues, which can be resolved by wrapping any state change in a setState call. Furthermore, this change slightly modified the shape of the widget tree: Prior to this change, the OverlayEntrys were wrapped in a Stack widget. The explicit Stack widget was removed from the widget hierarchy. Migration guide If you’re seeing issues after upgrading to a Flutter version that included this change, audit your code for missing calls to setState. In the example below, assigning the return value of Navigator.pushNamed to buttonLabel is implicitly modifying the state and it should be wrapped in an explicit setState call. Code before migration: class FooState extends State Foo String
https://docs.flutter.dev/release/breaking-changes/overlay-entry-rebuilds/index.html
528e61eb3962-2
extends State Foo String buttonLabel 'Click Me' @override Widget build BuildContext context return ElevatedButton onPressed: () async // Illegal state modification that should be wrapped in setState. buttonLabel await Navigator pushNamed context '/bar' ); }, child: Text buttonLabel ), ); Code after migration: class FooState extends State Foo
https://docs.flutter.dev/release/breaking-changes/overlay-entry-rebuilds/index.html
528e61eb3962-3
extends State Foo String buttonLabel 'Click Me' @override Widget build BuildContext context return ElevatedButton onPressed: () async final newLabel await Navigator pushNamed context '/bar' ); setState (() buttonLabel newLabel }); }, child: Text buttonLabel ), ); Timeline
https://docs.flutter.dev/release/breaking-changes/overlay-entry-rebuilds/index.html
528e61eb3962-4
), ); Timeline Landed in version: 1.16.3 In stable release: 1.17 References API documentation: setState OverlayEntry Overlay Navigator Route OverlayRoute Relevant issues: Issue 45797 Relevant PRs: Do not rebuild Routes when a new opaque Route is pushed on top Reland “Do not rebuild Routes when a new opaque Route is pushed on top”
https://docs.flutter.dev/release/breaking-changes/overlay-entry-rebuilds/index.html
02197a2841ef-0
Page transitions replaced by ZoomPageTransitionsBuilder Summary Context Description of change Migration guide Tests migration Timeline References Summary In order to ensure that libraries follow the latest OEM behavior, the default page transition builders now use ZoomPageTransitionsBuilder on all platforms (excluding iOS and macOS) instead of FadeUpwardsPageTransitionsBuilder. Context The FadeUpwardsPageTransitionsBuilder (provided with the first Flutter release), defined a page transition that’s similar to the one provided by Android O. This page transitions builder will eventually be deprecated on Android, as per Flutter’s deprecation policy. ZoomPageTransitionsBuilder, the new page transition builder for Android, Linux, and Windows, defines a page transition that’s similar to the one provided by Android Q and R.
https://docs.flutter.dev/release/breaking-changes/page-transition-replaced-by-ZoomPageTransitionBuilder/index.html
02197a2841ef-1
Style guide for Flutter repo, the framework will follow the latest OEM behavior. Page transition builders using Description of change Migration guide If you want to switch back to the previous page transition builder (FadeUpwardsPageTransitionsBuilder), you should define builders explicitly for the target platforms. Code before migration: MaterialApp theme: ThemeData primarySwatch: Colors blue ), Code after migration: MaterialApp theme: ThemeData pageTransitionsTheme: const PageTransitionsTheme builders: TargetPlatform PageTransitionsBuilder >{ TargetPlatform android
https://docs.flutter.dev/release/breaking-changes/page-transition-replaced-by-ZoomPageTransitionBuilder/index.html
02197a2841ef-2
>{ TargetPlatform android FadeUpwardsPageTransitionsBuilder (), // Apply this to every platforms you need. }, ), ), If you want to apply the same page transition builder to all platforms: MaterialApp theme: ThemeData pageTransitionsTheme: PageTransitionsTheme builders: Map TargetPlatform PageTransitionsBuilder fromIterable TargetPlatform values value: dynamic const FadeUpwardsPageTransitionsBuilder (), ), ), ), Tests migration
https://docs.flutter.dev/release/breaking-changes/page-transition-replaced-by-ZoomPageTransitionBuilder/index.html
02197a2841ef-3
), ), Tests migration If you used to try to find widgets but failed with Too many elements using the new transition, and saw errors similar to the following: You should migrate your tests by using the descendant scope for Finders with the specific widget type. Below is the example of DataTable’s test: Test before migration: final Finder finder find widgetWithIcon Transform Icons arrow_upward ); Test after migration: final Finder finder find descendant of: find byType DataTable ), matching:
https://docs.flutter.dev/release/breaking-changes/page-transition-replaced-by-ZoomPageTransitionBuilder/index.html
02197a2841ef-4
DataTable ), matching: find widgetWithIcon Transform Icons arrow_upward ), ); Widgets that typically need to migrate the finder scope are: Transform, FadeTransition, ScaleTransition, and ColoredBox. Timeline Landed in version: v2.13.0-1.0.pre In stable release: v3.0.0 References API documentation: ZoomPageTransitionsBuilder FadeUpwardsPageTransitionsBuilder PageTransitionsTheme Relevant issues: Issue 43277 Relevant PR: PR 100812
https://docs.flutter.dev/release/breaking-changes/page-transition-replaced-by-ZoomPageTransitionBuilder/index.html
46b480c3d928-0
The generic type of ParentDataWidget changed to ParentData Summary Context Description of change Migration guide Timeline References Summary The generic type of ParentDataWidget has changed from RenderObjectWidget to ParentData. Context Description of change Migration guide You must migrate your code as described in this section if you’re subclassing or implementing ParentDataWidget. If you do, the analyzer shows the following warnings when you upgrade to the Flutter version that includes this change: Code before migration: class FrogSize extends ParentDataWidget FrogJar FrogSize ({ Key key @required this
https://docs.flutter.dev/release/breaking-changes/parent-data-widget-generic-type/index.html
46b480c3d928-1
key @required this size @required Widget child }) assert child != null ), assert size != null ), super key: key child: child ); final Size size @override void applyParentData RenderObject renderObject final FrogJarParentData parentData renderObject parentData if parentData
https://docs.flutter.dev/release/breaking-changes/parent-data-widget-generic-type/index.html
46b480c3d928-2
parentData if parentData size != size parentData size size final RenderFrogJar targetParent renderObject parent targetParent markNeedsLayout (); class FrogJarParentData extends ParentData Size size class FrogJar extends RenderObjectWidget // ... Code after migration: class FrogSize extends ParentDataWidget FrogJarParentData
https://docs.flutter.dev/release/breaking-changes/parent-data-widget-generic-type/index.html
46b480c3d928-3
ParentDataWidget FrogJarParentData // FrogJar changed to FrogJarParentData FrogSize ({ Key key @required this size @required Widget child }) assert child != null ), assert size != null ), super key: key child: child ); final Size size @override void applyParentData RenderObject
https://docs.flutter.dev/release/breaking-changes/parent-data-widget-generic-type/index.html
46b480c3d928-4
void applyParentData RenderObject renderObject final FrogJarParentData parentData renderObject parentData if parentData size != size parentData size size final RenderFrogJar targetParent renderObject parent targetParent markNeedsLayout (); @override Type get debugTypicalAncestorWidgetClass FrogJar // Newly added Timeline
https://docs.flutter.dev/release/breaking-changes/parent-data-widget-generic-type/index.html
46b480c3d928-5
// Newly added Timeline Landed in version: 1.16.3 In stable release: 1.17 References API documentation: ParentDataWidget Relevant PR: Make ParentDataWidget usable with different ancestor RenderObjectWidget types
https://docs.flutter.dev/release/breaking-changes/parent-data-widget-generic-type/index.html
5b31441fef3b-0
Using HTML slots to render platform views in the web Summary Context Description of change Before After Migration guide Code Tests Timeline References Summary Flutter now renders all web platform views in a consistent location of the DOM, as direct children of flt-glass-pane (regardless of the rendering backend: html or canvaskit). Platform views are then “slotted” into the correct position of the App’s DOM with standard HTML features. Up until this change, Flutter web would change the styling of the rendered contents of a platform views to position/size it to the available space. This is no longer the case. Users can now decide how they want to utilize the space allocated to their platform view by the framework. Context
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-1
Context The Flutter framework frequently tweaks its render tree to optimize the paint operations that are ultimately made per frame. In the web, these render tree changes often result in DOM operations. Flutter web used to render its platform views (HtmlElementView widgets) directly into its corresponding position of the DOM. Using certain DOM elements as the “target” of some DOM operations causes those elements to lose their internal state. In practice, this means that iframe tags are going to reload, video players might restart, or an editable form might lose its edits. Flutter now renders platform views using slot elements inside of a single, app-wide shadow root. Slot elements can be added/removed/moved around the Shadow DOM without affecting the underlying slotted content (which is rendered in a constant location) This change was made to: Stabilize the behavior of platform views in Flutter web.
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-2
Stabilize the behavior of platform views in Flutter web. Unify how platform views are rendered in the web for both rendering backends (html and canvaskit). Provide a predictable location in the DOM that allows developers to reliably use CSS to style their platform views, and to use other standard DOM API, such as querySelector, and getElementById. Description of change A Flutter web app is now rendered inside a common shadow root in which slot elements represent platform views. The actual content of each platform view is rendered as a sibling of said shadow root. Before <flt-glass-pane> ... <div id= "platform-view" >Contents </div> <!-- canvaskit --> <!-- OR --> <flt-platform-view> #shadow-root |
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-3
<flt-platform-view> #shadow-root | <div id= "platform-view" >Contents </div> <!-- html --> </flt-platform-view> ... </flt-glass-pane> ... After <flt-glass-pane> #shadow-root | ... | <flt-platform-view-slot> | <slot name= "platform-view-1" /> | </flt-platform-view-slot> | ... <flt-platform-view slot= "platform-view-1" <div
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-4
"platform-view-1" <div id= "platform-view" >Contents </div> </flt-platform-view> ... </flt-glass-pane> ... After this change, when the framework needs to move DOM nodes around, it operates over flt-platform-view-slots, which only contain a slot element. The slot projects the contents defined in flt-platform-view elements outside the shadow root. flt-platform-view elements are never the target of DOM operations from the framework, thus preventing the reload issues. From an app’s perspective, this change is transparent. However, this is considered a breaking change because some tests make assumptions about the internal DOM of a Flutter web app, and break. Migration guide Code
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-5
Migration guide Code The engine may print a warning message to the console similar to: type: $viewType ] may not be set. Defaulting to `height: 100% . Set `style.height ` to any appropriate value to stop this message. or: type: $viewType ] may not be set. Defaulting to `width: 100% . Set `style.width ` to any appropriate value to stop this message. Previously, the content returned by PlatformViewFactory functions was resized and positioned by the framework. Instead, Flutter now sizes and positions <flt-platform-view-slot>, which is the parent of the slot where the content is projected.
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-6
To stop the warning above, platform views need to set the style.width and style.height of their root element to any appropriate (non-null) value. For example, to make the root html.Element fill all the available space allocated by the framework, set its style.width and style.height properties to '100%': ui platformViewRegistry registerViewFactory viewType int viewId final html Element htmlElement html DivElement () // ..other props style width '100%' style height '100%' // ... return htmlElement });
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-7
return htmlElement }); If other techniques are used to layout the platform view (like inset: 0) a value of auto for width and height is enough to stop the warning. Read more about CSS width and CSS height. Tests After this change, user’s test code does not need to deeply inspect the contents of the shadow root of the App. All of the platform view contents will be placed as direct children of flt-glass-pane, wrapped in a flt-platform-view element. Avoid looking inside the flt-glass-pane shadow root, it is considered a “private implementation detail”, and its markup can change at any time, without notice. (See Relevant PRs below for examples of the “migrations” described above). Timeline Landed in version: 2.3.0-16.0.pre In stable release: 2.5
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
5b31441fef3b-8
References Design document: Using slot to embed web Platform Views Relevant issues: Issue #80524 Relevant PRs: flutter/engine#25747: Introduces the feature. flutter/flutter#82926: Tweaks flutter tests. flutter/plugins#3964: Tweaks to plugins code. flutter/packages#364: Tweaks to packages code.
https://docs.flutter.dev/release/breaking-changes/platform-views-using-html-slots-web/index.html
b6c0a7fd7d70-0
Supporting the new Android plugins APIs Upgrade steps Testing your plugin Basic plugin UI/Activity plugin Note: You might be directed to this page if the framework detects that your app uses a plugin based on the old Android APIs. If you don’t write or maintain an Android Flutter plugin, you can skip this page. As of the 1.12 release, new plugin APIs are available for the Android platform. The old APIs based on PluginRegistry.Registrar won’t be immediately deprecated, but we encourage you to migrate to the new APIs based on FlutterPlugin. The new API has the advantage of providing a cleaner set of accessors for lifecycle dependent components compared to the old APIs. For instance PluginRegistry.Registrar.activity() could return null if Flutter isn’t attached to any activities.
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-1
In other words, plugins using the old API might produce undefined behaviors when embedding Flutter into an Android app. Most of the Flutter plugins provided by the flutter.dev team have been migrated already. (Learn how to become a verified publisher on pub.dev!) For an example of a plugin that uses the new APIs, see the battery plus package. Upgrade steps The following instructions outline the steps for supporting the new API: Update the main plugin class (*Plugin.java) to implement the FlutterPlugin interface. For more complex plugins, you can separate the FlutterPlugin and MethodCallHandler into two classes. See the next section, Basic plugin, for more details on accessing app resources with the latest version (v2) of embedding.
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-2
Also, note that the plugin should still contain the static registerWith() method to remain compatible with apps that don’t use the v2 Android embedding. (See Upgrading pre 1.12 Android projects for details.) The easiest thing to do (if possible) is move the logic from registerWith() into a private method that both registerWith() and onAttachedToEngine() can call. Either registerWith() or onAttachedToEngine() will be called, not both. In addition, you should document all non-overridden public members within the plugin. In an add-to-app scenario, these classes are accessible to a developer and require documentation. (Optional) If your plugin needs an Activity reference, also implement the ActivityAware interface. (Optional) If your plugin is expected to be held in a background Service at any point in time, implement the ServiceAware interface.
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-3
Update the example app’s MainActivity.java to use the v2 embedding FlutterActivity. For details, see Upgrading pre 1.12 Android projects. You might have to make a public constructor for your plugin class if one didn’t exist already. For example: package io.flutter.plugins.firebasecoreexample; import io.flutter.embedding.android.FlutterActivity; import io.flutter.embedding.engine.FlutterEngine; import io.flutter.plugins.firebase.core.FirebaseCorePlugin; public class MainActivity extends FlutterActivity { // You can keep this empty class or remove it. Plugins on the new embedding // now automatically registers plugins. } (Optional) If you removed MainActivity.java, update the <plugin_name>/example/android/app/src/main/AndroidManifest.xml to use io.flutter.embedding.android.FlutterActivity. For example:
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-4
<activity android:name="io.flutter.embedding.android.FlutterActivity" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale" android:hardwareAccelerated="true" android:exported="true" android:windowSoftInputMode="adjustResize"> <meta-data android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" android:value="true" /> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity>
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-5
(Optional) Create an EmbeddingV1Activity.java file] that uses the v1 embedding for the example project in the same folder as MainActivity to keep testing the v1 embedding’s compatibility with your plugin. Note that you have to manually register all the plugins instead of using GeneratedPluginRegistrant. For example: package io.flutter.plugins.batteryexample; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.battery.BatteryPlugin; public class EmbeddingV1Activity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BatteryPlugin.registerWith(registrarFor("io.flutter.plugins.battery.BatteryPlugin")); } }
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-6
Add <meta-data android:name="flutterEmbedding" android:value="2"/> to the <plugin_name>/example/android/app/src/main/AndroidManifest.xml. This sets the example app to use the v2 embedding. (Optional) If you created an EmbeddingV1Activity in the previous step, add the EmbeddingV1Activity to the <plugin_name>/example/android/app/src/main/AndroidManifest.xml file. For example: <activity android:name=".EmbeddingV1Activity" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale" android:hardwareAccelerated="true" android:exported="true" android:windowSoftInputMode="adjustResize"> </activity> Testing your plugin
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-7
Testing your plugin The remaining steps address testing your plugin, which we encourage, but aren’t required. Update <plugin_name>/example/android/app/build.gradle to replace references to android.support.test with androidx.test: defaultConfig { ... testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ... } dependencies { ... androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:rules:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' ... } Add tests files for MainActivity and EmbeddingV1Activity in <plugin_name>/example/android/app/src/androidTest/java/<plugin_path>/. You will need to create these directories. For example:
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-8
package io.flutter.plugins.firebase.core; import androidx.test.rule.ActivityTestRule; import io.flutter.plugins.firebasecoreexample.MainActivity; import org.junit.Rule; import org.junit.runner.RunWith; @RunWith(FlutterRunner.class) public class MainActivityTest { // Replace `MainActivity` with `io.flutter.embedding.android.FlutterActivity` if you removed `MainActivity`. @Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class); } package io.flutter.plugins.firebase.core; import androidx.test.rule.ActivityTestRule; import io.flutter.plugins.firebasecoreexample.EmbeddingV1Activity; import org.junit.Rule; import org.junit.runner.RunWith;
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-9
@RunWith(FlutterRunner.class) public class EmbeddingV1ActivityTest { @Rule public ActivityTestRule<EmbeddingV1Activity> rule = new ActivityTestRule<>(EmbeddingV1Activity.class); } Add integration_test and flutter_driver dev_dependencies to <plugin_name>/pubspec.yaml and <plugin_name>/example/pubspec.yaml. integration_test: sdk: flutter flutter_driver: sdk: flutter Update minimum Flutter version of environment in <plugin_name>/pubspec.yaml. All plugins moving forward will set the minimum version to 1.12.13+hotfix.6 which is the minimum version for which we can guarantee support. For example: environment: sdk: ">=2.16.1 <3.0.0" flutter: ">=1.17.0"
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-10
Create a simple test in <plugin_name>/test/<plugin_name>_test.dart. For the purpose of testing the PR that adds the v2 embedding support, we’re trying to test some very basic functionality of the plugin. This is a smoke test to ensure that the plugin properly registers with the new embedder. For example: import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('Can get battery level', (tester) async { final Battery battery = Battery(); final int batteryLevel = await battery.batteryLevel; expect(batteryLevel, isNotNull); }); } Test run the integration_test tests locally. In a terminal, do the following: flutter test integration_test/app_test.dart
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-11
flutter test integration_test/app_test.dart Basic plugin To get started with a Flutter Android plugin in code, start by implementing FlutterPlugin. public class MyPlugin implements FlutterPlugin @Override public void onAttachedToEngine @NonNull FlutterPluginBinding binding // TODO: your plugin is now attached to a Flutter experience. @Override public void onDetachedFromEngine @NonNull FlutterPluginBinding binding // TODO: your plugin is no longer attached to a Flutter experience.
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-12
// TODO: your plugin is no longer attached to a Flutter experience. As shown above, your plugin might (or might not) be associated with a given Flutter experience at any given moment in time. You should take care to initialize your plugin’s behavior in onAttachedToEngine(), and then cleanup your plugin’s references in onDetachedFromEngine(). The FlutterPluginBinding provides your plugin with a few important references: Returns the FlutterEngine that your plugin is attached to, providing access to components like the DartExecutor, FlutterRenderer, and more. Returns the Android application’s Context for the running app. UI/Activity plugin If your plugin needs to interact with the UI, such as requesting permissions, or altering Android UI chrome, then you need to take additional steps to define your plugin. You must implement the ActivityAware interface. public class MyPlugin implements
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-13
class MyPlugin implements FlutterPlugin ActivityAware //...normal plugin behavior is hidden... @Override public void onAttachedToActivity ActivityPluginBinding activityPluginBinding // TODO: your plugin is now attached to an Activity @Override public void onDetachedFromActivityForConfigChanges () // TODO: the Activity your plugin was attached to was // destroyed to change configuration. // This call will be followed by onReattachedToActivityForConfigChanges(). @Override public void onReattachedToActivityForConfigChanges ActivityPluginBinding activityPluginBinding
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-14
ActivityPluginBinding activityPluginBinding // TODO: your plugin is now attached to a new Activity // after a configuration change. @Override public void onDetachedFromActivity () // TODO: your plugin is no longer associated with an Activity. // Clean up references. To interact with an Activity, your ActivityAware plugin must implement appropriate behavior at 4 stages. First, your plugin is attached to an Activity. You can access that Activity and a number of its callbacks through the provided ActivityPluginBinding. Since Activitys can be destroyed during configuration changes, you must cleanup any references to the given Activity in onDetachedFromActivityForConfigChanges(), and then re-establish those references in onReattachedToActivityForConfigChanges().
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
b6c0a7fd7d70-15
Finally, in onDetachedFromActivity() your plugin should clean up all references related to Activity behavior and return to a non-UI configuration.
https://docs.flutter.dev/release/breaking-changes/plugin-api-migration/index.html
ec08865564b1-0
Default `PrimaryScrollController` on Desktop Summary Context Description of change Migration guide Timeline References Summary The PrimaryScrollController API has been updated to no longer automatically attach to vertical ScrollViews on desktop platforms. Context Prior to this change, ScrollView.primary would default to true if a ScrollView had an Axis.vertical scroll direction and a ScrollController had not already been provided. This allowed for common UI patterns, like the scroll-to-top function on iOS to work out of the box for Flutter apps. On desktop however, this default would often cause the following assertion error:
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-1
While it is common for a mobile application to display one ScrollView at a time, desktop UI patterns are more likely to display multiple ScrollViews side-by-side. The prior implementation of PrimaryScrollController conflicted with this pattern, resulting in an often unhelpful error message. To remedy this, the PrimaryScrollController has been updated with additional parameters as well as better error messaging across multiple widgets that depend on it. Description of change The previous implementation of ScrollView resulted in primary being true by default for all vertical ScrollViews that did not already have a ScrollController, on all platforms. This default behavior was not always clear, particularly because it is separate from the PrimaryScrollController itself. // Previously, this ListView would always result in primary being true, // and attached to the PrimaryScrollController on all platforms. Scaffold body: ListView builder itemBuilder: BuildContext context
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-2
itemBuilder: BuildContext context int index return Text 'Item $index ); ), ); The new members of the PrimaryScrollController class, automaticallyInheritForPlatforms and scrollDirection, are evaluated in shouldInherit, allowing users clarity and control over the PrimaryScrollController’s behavior. By default, backwards compatibility is maintained for mobile platforms. PrimaryScrollController.shouldInherit returns true for vertical ScrollViews. On desktop, this returns false by default. // Only on mobile platforms will this attach to the PrimaryScrollController by // default. Scaffold body: ListView builder itemBuilder: BuildContext context int
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-3
BuildContext context int index return Text 'Item $index ); ), ); To change the default, users can set ScrollView.primary true or false to explicitly manage the PrimaryScrollController for an individual ScrollView. For behavior across multiple ScrollViews, the PrimaryScrollController is now configurable by setting the specific platform, as well as the scroll direction that is preferred for inheritance. Widgets that use the PrimaryScrollController, such as NestedScrollView, Scrollbar, and DropdownMenuButton will experience no change to existing functionality. Features like the iOS scroll-to-top will also continue to work as expected without any migration.
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-4
If more than one ScrollView was present previous to this change, the same assertion (ScrollController attached to multiple ScrollViews.) would be thrown. Now, on desktop platforms, users need to specify primary: true to designate which ScrollView is the fallback to receive unhandled keyboard Shortcuts. Migration guide Code before migration: // These side-by-side ListViews would throw errors from Scrollbars and // ScrollActions previously due to the PrimaryScrollController. Scaffold body: LayoutBuilder builder: context constraints return Row children: SizedBox height: constraints maxHeight width: constraints maxWidth child: ListView builder
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-5
child: ListView builder itemBuilder: BuildContext context int index return Text 'List 1 - Item $index ); ), ), SizedBox height: constraints maxHeight width: constraints maxWidth child: ListView builder itemBuilder: BuildContext context int index return Text 'List 2 - Item $index ); ), ), );
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-6
); ), ), ); }, ), ); Code after migration: // These side-by-side ListViews will no longer throw errors, but for // default ScrollActions, one will need to be designated as primary. Scaffold body: LayoutBuilder builder: context constraints return Row children: SizedBox height: constraints maxHeight width: constraints maxWidth child: ListView builder // This ScrollView will use the PrimaryScrollController primary: true
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-7
primary: true itemBuilder: BuildContext context int index return Text 'List 1 - Item $index ); ), ), SizedBox height: constraints maxHeight width: constraints maxWidth child: ListView builder itemBuilder: BuildContext context int index return Text 'List 2 - Item $index ); ), ), ); },
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
ec08865564b1-8
), ), ); }, ), ); Timeline Landed in version: 3.3.0-0.0.pre In stable release: 3.3 References API documentation: PrimaryScrollController ScrollView ScrollAction ScrollIntent Scrollbar Design Document Updating PrimaryScrollController Relevant issues: Issue #100264 Relevant PRs: Updating PrimaryScrollController for Desktop
https://docs.flutter.dev/release/breaking-changes/primary-scroll-controller-desktop/index.html
b8451611e730-0
Raw images on Web uses correct origin and colors Summary Context Description of change Migration guide Timeline References Summary How raw images are rendered on Web has been corrected and is now consistent with that on other platforms. This breaks legacy apps that had to feed incorrect data to ui.ImageDescriptor.raw or ui.decodeImageFromPixels, causing the resulting images to be upside-down and incorrectly colored (whose red and blue channels are swapped.) Context The “pixel stream” that Flutter uses internally has always been defined as the same format: for each pixel, four 8-bit channels are packed in the order defined by a format argument, then grouped in a row, from left to right, then rows from top to bottom.
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-1
However, Flutter for Web, or more specifically, the HTML renderer, used to implement it in a wrong way due to incorrect understanding of the BMP format specification. As a result, if the app or library uses ui.ImageDescriptor.raw or ui.decodeImageFromPixels, it had to feed pixels from bottom to top and swap their red and blue channels (for example, with the ui.PixelFormat.rgba8888 format, the first 4 bytes of the data were considered the blue, green, red, and alpha channels of the first pixel instead.) This bug has been fixed by engine#29593, but apps and libraries have to correct how their data are generated. Description of change The pixels argument of ui.ImageDescriptor.raw or ui.decodeImageFromPixels now uses the correct pixel order described by format, and originates from the top left corner.
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-2
Images rendered by directly calling these two functions Legacy code that invokes these functions directly might find their images upside down and colored incorrectly. Migration guide If the app uses the latest version of Flutter and experiences this situation, the most direct solution is to manually flip the image, and use the alternate pixel format. However, this is unlikely the most optimized solution, since such pixel data are usually constructed from other sources, allowing flipping during the construction process. Code before migration: import 'dart:typed_data' import 'dart:ui' as ui // Parse `image` as a displayable image. // // Each byte in `image` is a pixel channel, in the order of blue, green, red, // and alpha, starting from the bottom left corner and going row first. Future
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-3
Future ui Image parseMyImage Uint8List image int width int height async final ui ImageDescriptor descriptor ui ImageDescriptor raw await ui ImmutableBuffer fromUint8List image ), width: width height: height pixelFormat: ui PixelFormat rgba8888 ); return await await descriptor
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-4
await await descriptor instantiateCodec ()) getNextFrame ()) image Code after migration: import 'dart:typed_data' import 'dart:ui' as ui Uint8List verticallyFlipImage Uint8List sourceBytes int width int height final Uint32List source Uint32List sublistView ByteData sublistView sourceBytes )) final
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-5
sourceBytes )) final Uint32List result Uint32List source length int sourceOffset int resultOffset for final int row height row row = sourceOffset width row for final int col col width col += result resultOffset source sourceOffset resultOffset += sourceOffset +=
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-6
+= sourceOffset += return Uint8List sublistView ByteData sublistView sourceBytes )) Future ui Image parseMyImage Uint8List image int width int height async final Uint8List correctedImage verticallyFlipImage image width height ); final ui ImageDescriptor descriptor ui ImageDescriptor raw await
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-7
ImageDescriptor raw await ui ImmutableBuffer fromUint8List correctedImage ), width: width height: height pixelFormat: ui PixelFormat rgba8888 ); return await await descriptor instantiateCodec ()) getNextFrame ()) image A trickier situation is when you’re writing a library, and you want this library to work on both the most recent Flutter and a pre-patch one. In that case, you can decide whether the behavior has been changed by letting it decode a single pixel first.
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-8
Code after migration: Uint8List verticallyFlipImage Uint8List sourceBytes int width int height // Same as the example above. late Future bool imageRawUsesCorrectBehavior (() async final ui ImageDescriptor descriptor ui ImageDescriptor raw await ui ImmutableBuffer fromUint8List Uint8List fromList (< int >[ 0xED 0xFF
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-9
0xED 0xFF ])), width: height: pixelFormat: ui PixelFormat rgba8888 ); final ui Image image await await descriptor instantiateCodec ()) getNextFrame ()) image final Uint8List resultPixels Uint8List sublistView await image toByteData format: ui ImageByteFormat rawStraightRgba
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-10
ImageByteFormat rawStraightRgba )) ); return resultPixels == 0xED })(); Future ui Image parseMyImage Uint8List image int width int height async final Uint8List correctedImage await imageRawUsesCorrectBehavior verticallyFlipImage image width height image final ui ImageDescriptor descriptor ui ImageDescriptor
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-11
descriptor ui ImageDescriptor raw await ui ImmutableBuffer fromUint8List correctedImage ), // Use the corrected image width: width height: height pixelFormat: ui PixelFormat bgra8888 // Use the alternate format ); return await await descriptor instantiateCodec ()) getNextFrame ()) image Timeline Landed in version: 2.9.0-0.0.pre In stable release: 2.10
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
b8451611e730-12
References API documentation: decodeImageFromPixels ImageDescriptor.raw Relevant issues: Web: Regression in Master - PDF display distorted due to change in BMP Encoder Web: ImageDescriptor.raw flips and inverts images (partial reason included) Relevant PRs: Web: Reland: Fix BMP encoder Clarify ImageDescriptor.raw pixel order and add version detector
https://docs.flutter.dev/release/breaking-changes/raw-images-on-web-uses-correct-origin-and-colors/index.html
afa713b83127-0
Dry layout support for RenderBox Summary Context Description of change Migration guide Timeline References Summary Context RenderBox.computeMinIntrinsicWidth and friends). Description of change Subclasses of RenderBox need to override the new computeDryLayout method if they are used as a descendant of a RenderObject that may query the intrinsic size of its children. Examples of widgets that do this are IntrinsicHeight and IntrinsicWidth. The default implementation of RenderBox.performResize also uses the size computed by computeDryLayout to perform the resize. Overriding performResize is therefore no longer necessary. Migration guide
https://docs.flutter.dev/release/breaking-changes/renderbox-dry-layout/index.html
afa713b83127-1
Migration guide Subclasses that already override performResize can be migrated by simply changing the function signature from void performResize() to Size computeDryLayout(BoxConstraints constraints) and by returning the calculated size instead of assigning it to the size setter. The old implementation of performResize can be removed. Code before migration: @override void performResize () size constraints biggest Code after migration: // This replaces the old performResize method. @override Size computeDryLayout BoxConstraints constraints return constraints biggest
https://docs.flutter.dev/release/breaking-changes/renderbox-dry-layout/index.html
afa713b83127-2
constraints return constraints biggest If for some reason it is impossible to calculate the dry layout, computeDryLayout must call debugCannotComputeDryLayout from within an assert and return a dummy size of const Size(0, 0). Calculating a dry layout is, for example, impossible if the size of a RenderBox depends on the baseline metrics of its children. @override Size computeDryLayout BoxConstraints constraints assert debugCannotComputeDryLayout reason: 'Layout requires baseline metrics, which are only available after a full layout.' )); return const Size ); Timeline
https://docs.flutter.dev/release/breaking-changes/renderbox-dry-layout/index.html
afa713b83127-3
Size ); Timeline Landed in version: 1.25.0-4.0.pre In stable release: 2.0.0 References API documentation: RenderBox computeMinInstrinsicWidth computeDryLayout getDryLayout performResize RenderWrap RenderParagraph Relevant issues: Issue 48679 Relevant PRs: Fixes Intrinsics for RenderParagraph and RenderWrap
https://docs.flutter.dev/release/breaking-changes/renderbox-dry-layout/index.html
b606d36c0a0e-0
Bottom Navigation Title To Label Summary Context Description of change Migration guide Timeline References Summary BottomNavigationBarItem.title gives a deprecation warning, or no longer exists when referenced in code. Context Description of change Migration guide Code before migration: BottomNavigationBarItem icon: Icons add title: Text 'add' ), Code after migration: BottomNavigationBarItem icon: Icons add label: 'add' Timeline
https://docs.flutter.dev/release/breaking-changes/bottom-navigation-title-to-label/index.html
b606d36c0a0e-1
label: 'add' Timeline Landed in version: 1.22.0 In stable release: 2.0.0 References API documentation: BottomNavigationBarItem Relevant PRs: PR 60655: Clean up hero controller scope PR 59127: Update BottomNavigationBar to show tooltips on long press][]. Breaking change proposal: Breaking Change: Bottom Navigation Item Title
https://docs.flutter.dev/release/breaking-changes/bottom-navigation-title-to-label/index.html
83e9b713e417-0
Introducing package:flutter_lints Summary Context Migration guide Existing custom analysis_options.yaml file Customizing the lints Timeline References Summary The package:flutter_lints defines the latest set of recommended lints that encourage good coding practices for Flutter apps, packages, and plugins. Projects created with flutter create using Flutter version 2.5 or newer are already enabled to use the latest set of recommended lints. Projects created prior to that version can upgrade to it with the instructions in this guide. Context analysis_options_user.yaml that was used by the dart analyzer to identify code issues if a Flutter project didn’t define a custom package:lints it also aligns the lints recommended for Flutter projects with the rest of the Dart ecosystem.
https://docs.flutter.dev/release/breaking-changes/flutter-lints-package/index.html
83e9b713e417-1
Migration guide Follow these steps to migrate your Flutter project to use the latest recommended lints from package:flutter_lints: Add a dev_dependency on package:flutter_lints to your project’s pubspec.yaml by running flutter pub add --dev flutter_lints in the root directory of the project. Create an analysis_options.yaml file in the root directory of your project (next to the pubspec.yaml file) with the following content: include package:flutter_lints/flutter.yaml The newly activated lint set may identify some new issues in your code. To find them, open your project in an IDE with Dart support or run flutter analyze on the command line. You may be able to fix some of the reported issues automatically by running dart fix --apply in the root directory of your project. Existing custom analysis_options.yaml file Customizing the lints
https://docs.flutter.dev/release/breaking-changes/flutter-lints-package/index.html
83e9b713e417-2
Existing custom analysis_options.yaml file Customizing the lints The lints activated for a given project can be further customized in the analysis_options.yaml file. This is shown in the example file below, which is a reproduction of the analysis_options.yaml file generated by flutter create for new projects. # This file configures the analyzer, which statically analyzes Dart code to # check for errors, warnings, and lints. # The issues identified by the analyzer are surfaced in the UI of Dart-enabled # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be # invoked from the command line by running `flutter analyze`. # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. include
https://docs.flutter.dev/release/breaking-changes/flutter-lints-package/index.html
83e9b713e417-3
# packages, and plugins designed to encourage good coding practices. include package:flutter_lints/flutter.yaml linter # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` # included above or to enable additional rules. A list of all available lints # and their documentation is published at # https://dart-lang.github.io/linter/lints/index.html. # Instead of disabling a lint rule for the entire project in the # section below, it can also be suppressed for a single line of code # or a specific dart file by using the `// ignore: name_of_lint` and # `// ignore_for_file: name_of_lint` syntax on the line or in the file
https://docs.flutter.dev/release/breaking-changes/flutter-lints-package/index.html
83e9b713e417-4
# producing the lint. rules # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options Timeline Landed in version: 2.3.0-12.0.pre In stable release: 2.5 References Documentation: package:flutter_lints Package dependencies Customizing static analysis Relevant issues: Issue 78432 - Update lint set for Flutter applications Relevant PRs: Add flutter_lints package
https://docs.flutter.dev/release/breaking-changes/flutter-lints-package/index.html
83e9b713e417-5
Relevant PRs: Add flutter_lints package Integrate package:flutter_lints into templates
https://docs.flutter.dev/release/breaking-changes/flutter-lints-package/index.html
11c5cb0899f8-0
Semantics Order of the Overlay Entries in Modal Routes Summary Context Description of change Migration guide Timeline References Summary We changed the semantics traverse order of the overlay entries in modal routes. Accessibility talk back or voice over now focuses the scope of a modal route first instead of its modal barrier. Context The modal route has two overlay entries, the scope and the modal barrier. The scope is the actual content of the modal route, and the modal barrier is the background of the route if its scope does not cover the entire screen. If the modal route returns true for barrierDismissible, the modal barrier becomes accessibility focusable because users can tap the modal barrier to pop the modal route. This change specifically made the accessibility to focus the scope first before the modal barrier. Description of change
https://docs.flutter.dev/release/breaking-changes/modal-router-semantics-order/index.html