Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

docs.flutter.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.

Learn more

Flutter 3.41 is live! Check out theFlutter 3.41 blog post!

Deprecated API removed after v3.19

After reaching end of life, the following deprecated APIs were removed from Flutter.

Summary

#

In accordance with Flutter'sDeprecation Policy, deprecated APIs that reached end of life after the 3.19 stable release have been removed.

All affected APIs have been compiled into this primary source to aid in migration. To further aid your migration, check out thisquick reference sheet.

Changes

#

This section lists the deprecations by the package and affected class.

TextTheme

#

Package: flutter Supported by Flutter Fix: yes

SeveralTextStyle properties ofTextTheme were deprecated in v3.1 to support new stylings from the Material Design specification. They are listed in the following table alongside the appropriate replacement in the new API.

DeprecationNew API
headline1displayLarge
headline2displayMedium
headline3displaySmall
headline4headlineMedium
headline5headlineSmall
headline6titleLarge
subtitle1titleMedium
subtitle2titleSmall
bodyText1bodyLarge
bodyText2bodyMedium
captionbodySmall
buttonlabelLarge
overlinelabelSmall

Migration guide

Code before migration:

dart
// TextTheme// Base constructorTextTheme(headline1:headline1Style,headline2:headline2Style,headline3:headline3Style,headline4:headline4Style,headline5:headline5Style,headline6:headline6Style,subtitle1:subtitle1Style,subtitle2:subtitle2Style,bodyText1:bodyText1Style,bodyText2:bodyText2Style,caption:captionStyle,button:buttonStyle,overline:overlineStyle,);// copyWithTextTheme.copyWith(headline1:headline1Style,headline2:headline2Style,headline3:headline3Style,headline4:headline4Style,headline5:headline5Style,headline6:headline6Style,subtitle1:subtitle1Style,subtitle2:subtitle2Style,bodyText1:bodyText1Style,bodyText2:bodyText2Style,caption:captionStyle,button:buttonStyle,overline:overlineStyle,);// GettersTextStylestyle;style=textTheme.headline1,style=textTheme.headline2,style=textTheme.headline3,style=textTheme.headline4,style=textTheme.headline5,style=textTheme.headline6,style=textTheme.subtitle1,style=textTheme.subtitle2,style=textTheme.bodyText1,style=textTheme.bodyText2,style=textTheme.caption,style=textTheme.button,style=textTheme.overline,

Code after migration:

dart
// TextTheme// Base constructorTextTheme(displayLarge:headline1Style,displayMedium:headline2Style,displaySmall:headline3Style,headlineMedium:headline4Style,headlineSmall:headline5Style,titleLarge:headline6Style,titleMedium:subtitle1Style,titleSmall:subtitle2Style,bodyLarge:bodyText1Style,bodyMedium:bodyText2Style,bodySmall:captionStyle,labelLarge:buttonStyle,labelSmall:overlineStyle,);TextTheme.copyWith(displayLarge:headline1Style,displayMedium:headline2Style,displaySmall:headline3Style,headlineMedium:headline4Style,headlineSmall:headline5Style,titleLarge:headline6Style,titleMedium:subtitle1Style,titleSmall:subtitle2Style,bodyLarge:bodyText1Style,bodyMedium:bodyText2Style,bodySmall:captionStyle,labelLarge:buttonStyle,labelSmall:overlineStyle,);TextStylestyle;style=textTheme.displayLarge;style=textTheme.displayMedium;style=textTheme.displaySmall;style=textTheme.headlineMedium;style=textTheme.headlineSmall;style=textTheme.titleLarge;style=textTheme.titleMedium;style=textTheme.titleSmall;style=textTheme.bodyLarge;style=textTheme.bodyMedium;style=textTheme.bodySmall;style=textTheme.labelLarge;style=textTheme.labelSmall;

References

API documentation:

Relevant PRs:


ThemeData

#

Package: flutter Supported by Flutter Fix: yes

SeveralColor properties ofThemeData were deprecated in v3.3 to support new stylings from the Material Design specification. These colors wereerrorColor,backgroundColor,bottomAppBarColor, andtoggleableActiveColor. The first two are replaced by properties of theThemeData.colorScheme, whilebottomAppBarColor is replaced by the color of the component theme,BottomAppBarTheme. ThetoggleableActiveColor was no longer used by the framework and was removed.

Migration guide

Code before migration:

dart
varmyTheme=ThemeData(//...errorColor:Colors.red,backgroundColor:Colors.blue,bottomAppBarColor:Colors.purple,toggleableActiveColor:Colors.orange,//...);varerrorColor=myTheme.errorColor;varbackgroundColor=myTheme.backgroundColor;varbottomAppBarColor=myTheme.bottomAppBarColor;vartoggleableActiveColor=myTheme.toggleableActiveColor;

Code after migration:

dart
varmyTheme=ThemeData(//...colorScheme:ColorScheme(/// ...error:Colors.red,background:Colors.blue,),bottomAppBarTheme:BottomAppBarTheme(color:Colors.purple,),//...);varerrorColor=myTheme.colorScheme.error;varbackgroundColor=myTheme.colorScheme.background;varbottomAppBarColor=myTheme.bottomAppBarTheme.color;vartoggleableActiveColor=Colors.orange;

References

API documentation:

Relevant PRs:


CupertinoContextMenu.previewBuilder

#

Package: flutter Supported by Flutter Fix: yes

ThepreviewBuilder was replaced by thebuilder ofCupertinoContextMenu after v3.4. By addingbuilder, the entirety of the animation executed by the context menu is covered, the second half of which was performed bypreviewBuilder, and delineated byCupertinoContextMenu.animationOpensAt.

Migration guide

Code before migration:

dart
CupertinoContextMenu(previewBuilder:(BuildContextcontext,Animation<double>animation,Widgetchild){returnFittedBox(fit:BoxFit.cover,child:ClipRRect(borderRadius:BorderRadius.circular(64.0*animation.value),child:Image.asset('assets/photo.jpg'),),);},actions:<Widget>[CupertinoContextMenuAction(child:constText('Action one'),onPressed:(){},),],child:FittedBox(fit:BoxFit.cover,child:Image.asset('assets/photo.jpg'),),);

Code after migration:

dart
CupertinoContextMenu(actions:<Widget>[CupertinoContextMenuAction(child:constText('Action one'),onPressed:(){},),],builder:(BuildContextcontext,Animation<double>animation){finalAnimation<BorderRadius?>borderRadiusAnimation=BorderRadiusTween(begin:BorderRadius.circular(0.0),end:BorderRadius.circular(CupertinoContextMenu.kOpenBorderRadius),).animate(CurvedAnimation(parent:animation,curve:Interval(CupertinoContextMenu.animationOpensAt,1.0,),),);finalAnimation<Decoration>boxDecorationAnimation=DecorationTween(begin:constBoxDecoration(color:Color(0xFFFFFFFF),boxShadow:<BoxShadow>[],),end:BoxDecoration(color:Color(0xFFFFFFFF),boxShadow:CupertinoContextMenu.kEndBoxShadow,),).animate(CurvedAnimation(parent:animation,curve:Interval(0.0,CupertinoContextMenu.animationOpensAt,)));returnContainer(decoration:animation.value<CupertinoContextMenu.animationOpensAt?boxDecorationAnimation.value:null,child:FittedBox(fit:BoxFit.cover,child:ClipRRect(borderRadius:borderRadiusAnimation.value??BorderRadius.circular(0.0),child:SizedBox(height:150,width:150,child:Image.asset('assets/photo.jpg'),),),));})

References

API documentation:

Relevant PRs:


Scrollbar.showTrackOnHover

#

Package: flutter Supported by Flutter Fix: yes

TheshowTrackOnHover property ofScrollbar, and its associated component theme,ScrollbarThemeData.showTrackOnHover, were replaced by the stateful propertyScrollbarThemeData.trackVisibility after v3.4. By utilizingtrackVisibility, all permutations of state can factor into revealing the scrollbar track, not just hover.

Migration guide

Code before migration:

dart
Scrollbar(showTrackOnHover:true,child://...);ScrollbarThemeData(showTrackOnHover:true,);

Code after migration:

dart
Scrollbar(child://...);ScrollbarThemeData(// This will always show the track for any state.trackVisibility:MaterialStateProperty<bool>.all(true),);// OrScrollbarThemeData(// Only show on hover.trackVisibility:(Set<MaterialState>states)=>states.contains(MaterialState.hovered),);

References

API documentation:

Relevant PRs:


KeepAliveHandle.release method

#

Package: flutter Supported by Flutter Fix: no

Therelease method ofKeepAliveHandle was removed and replaced by callingdispose after v3.3. This change was made becauserelease was found to often be called without then callingdispose, leading to memory leaks. Thedispose method executes the same functionality asrelease did now.

Migration guide

Code before migration:

dart
KeepAliveHandlehandle=KeepAliveHandle();handle.release();handle.dispose();

Code after migration:

dart
KeepAliveHandlehandle=KeepAliveHandle();handle.dispose();

References

API documentation:

Relevant PRs:


InteractiveViewer.alignPanAxis

#

Package: flutter Supported by Flutter Fix: yes

ThealignPanAxis property ofInteractiveViewer was removed and replaced withpanAxis after v3.3. This change was made to enable more modes of panning inInteractiveViewer.

Migration guide

Code before migration:

dart
InteractiveViewer(alignPanAxis:true,);

Code after migration:

dart
InteractiveViewer(panAxis:PanAxis.aligned,);

References

API documentation:

Relevant PRs:


MediaQuery.boldTextOverride

#

Package: flutter Supported by Flutter Fix: yes

TheboldTextOverride method ofMediaQuery was removed and replaced withboldTextOf after v3.5. This change was made as part of larger refactor ofMediaQuery, most notably reducing the number of rebuilds that would be triggered by widgets that depend on it.

Migration guide

Code before migration:

dart
MediaQuery.boldTextOverride(context);

Code after migration:

dart
MediaQuery.boldTextOf(context)

References

API documentation:

Relevant PRs:


Renamed builder typedefs forAnimatedList

#

Package: flutter Supported by Flutter Fix: no

With the addition ofAnimatedGrid,AnimatedList was refactored to share a common base class. The previously namedAnimatedListItemBuilder andAnimatedListRemovedItemBuilder were renamed to better reflect the classes they could be used with after v3.5. Rename any references toAnimatedItemBuilder andAnimatedRemovedItemBuilder.

References

API documentation:

Relevant PRs:


FlutterDriver.enableAccessibility

#

Package: flutter_driver Supported by Flutter Fix: yes

TheenableAccessibility method offlutterDriver was deprecated in v2.3. It was removed and replaced withsetSemantics. This change made is possible to enable or disable accessibility, rather than only enable it.

Migration guide

Code before migration:

dart
FlutterDriverdriver=FlutterDriver.connectedTo(// ...);driver.enableAccessibility();

Code after migration:

dart
FlutterDriverdriver=FlutterDriver.connectedTo(// ...);driver.setSemantics(true);

References

API documentation:

Relevant PRs:


TimelineSummary.writeSummaryToFile

#

Package: flutter_driver Supported by Flutter Fix: yes

ThewriteSummaryToFile method ofTimelineSummary was deprecated in v2.1. It was removed and replaced withwriteTimelineToFile.

Migration guide

Code before migration:

dart
TimelineSummarysummary=TimelineSummary.summarize(myTimeline,);summary.writeSummaryToFile(traceName,pretty:true,);

Code after migration:

dart
TimelineSummarysummary=TimelineSummary.summarize(myTimeline,);summary.writeTimelineToFile(traceName,pretty:true,);

References

API documentation:

Relevant PRs:

Android Platform Views on API 22 and below

#

Supported by Flutter Fix: no

As of Flutter 3.0 platform views require api 23 or higher. In Flutter 3.19 we now throw UnsupportedOperationException when using platform views on android devices running api level 22 and below.

Migration guide

Set minimum api level to 23 (or higher) or check the android api level before displaying a platform view.


Thepreviously announced deprecations for context menus, relating toToolbarOptions as well as parts ofTextSelectionController andSelectableRegionState were not removed this cycle, to allow more time for migration. Expect these deprecations to be removed in the next cycle, which will be announced again when the time comes.


Timeline

#

In stable release: 3.22.0

Was this page's content helpful?

Unless stated otherwise, the documentation on this site reflects Flutter 3.38.6. Page last updated on 2025-10-30.View source orreport an issue.


[8]ページ先頭

©2009-2026 Movatter.jp