Deprecated API removed after v2.5

Summary

In accordance with Flutter’s Deprecation Policy, deprecated APIs that reached end of life after the 2.5 stable release have been removed.

All affected APIs have been compiled into this primary source to aid in migration. A quick reference sheet is available as well.

Changes

This section lists the deprecations by affected class.


Supported by Flutter Fix: yes

autovalidate was deprecated in v1.19.

Use autovalidateMode instead. Where autovalidate was true, replace with AutovalidateMode.always. Where autovalidate was false, replace with AutovalidateMode.disabled. This change allows more behaviors to be specified beyond the original binary choice, adding AutovalidateMode.onUserInteraction as an additional option.

The following classes all have the same change of API:

  • Form
  • FormField
  • DropdownButtonFormField
  • TextFormField

Migration guide

In-depth migration guide available

Code before migration:

const Form form = Form(autovalidate: true);
const Form form = Form(autovalidate: false);
final autoMode = form.autovalidate;

const FormField formField = FormField(autovalidate: true);
const FormField formField = FormField(autovalidate: false);
final autoMode = formField.autovalidate;

const TextFormField textFormField = TextFormField(autovalidate: true);
const TextFormField textFormField = TextFormField(autovalidate: false);

const DropdownButtonFormField dropDownButtonFormField = DropdownButtonFormField(autovalidate: true);
const DropdownButtonFormField dropdownButtonFormField = DropdownButtonFormField(autovalidate: false);

Code after migration:

const Form form = Form(autovalidateMode: AutovalidateMode.always);
const Form form = Form(autovalidateMode: AutovalidateMode.disabled);
final autoMode = form.autovalidateMode;

const FormField formField = FormField(autovalidateMode: AutovalidateMode.always);
const FormField formField = FormField(autovalidateMode: AutovalidateMode.disabled);
final autoMode = formField.autovalidateMode;

const TextFormField textFormField = TextFormField(autovalidateMode: AutovalidateMode.always);
const TextFormField textFormField = TextFormField(autovalidateMode: AutovalidateMode.disabled);

const DropdownButtonFormField dropDownButtonFormField = DropdownButtonFormField(autovalidateMode: AutovalidateMode.always);
const DropdownButtonFormField dropdownButtonFormField = DropdownButtonFormField(autovalidateMode: AutovalidateMode.disabled);

References

API documentation:

Relevant issues:

Relevant PRs:


FloatingHeaderSnapConfiguration.vsync

Supported by Flutter Fix: no

The TickerProvider vsync property of FloatingHeaderSnapConfiguration was deprecated in v1.19.

The vsync for the animation should instead be specified using SliverPersistentHeaderDelegate.vsync.

Migration guide

Code before migration:

class MySliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
  FloatingHeaderSnapConfiguration? get snapConfiguration => FloatingHeaderSnapConfiguration(vsync: myTickerProvider);
}

Code after migration:

class MySliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
  FloatingHeaderSnapConfiguration? get snapConfiguration => FloatingHeaderSnapConfiguration();
  TickerProvider? get vsync => myTickerProvider;
}

References

Design document:

API documentation:

Relevant issues:

Relevant PRs:


AndroidViewController & subclasses’ id

Supported by Flutter Fix: yes

The id of AndroidViewController, TextureAndroidViewController, and SurfaceAndroidViewController, was deprecated in v1.20.

For all of these use cases, viewId should be used instead.

Migration guide

Code before migration:

final SurfaceAndroidViewController surfaceController = SurfaceAndroidViewController(
  viewId: 10,
  viewType: 'FixTester',
  layoutDirection: TextDirection.ltr,
);
int viewId = surfaceController.id;
final SurfaceAndroidViewController surfaceController = SurfaceAndroidViewController(
  error: '',
);
final TextureAndroidViewController textureController = TextureAndroidViewController(
  error: '',
);
final TextureAndroidViewController textureController = TextureAndroidViewController(
  viewId: 10,
  viewType: 'FixTester',
  layoutDirection: TextDirection.ltr,
);
viewId = textureController.id;

Code after migration:

final SurfaceAndroidViewController surfaceController = SurfaceAndroidViewController(
  viewId: 10,
  viewType: 'FixTester',
  layoutDirection: TextDirection.ltr,
);
int viewId = surfaceController.viewId;
final SurfaceAndroidViewController surfaceController = SurfaceAndroidViewController(
  error: '',
);
final TextureAndroidViewController textureController = TextureAndroidViewController(
  error: '',
);
final TextureAndroidViewController textureController = TextureAndroidViewController(
  viewId: 10,
  viewType: 'FixTester',
  layoutDirection: TextDirection.ltr,
);
viewId = textureController.viewId;

References

Design document:

API documentation:

Relevant issues:

Relevant PRs:


BlacklistingTextInputFormatter & WhitelistingTextInputFormatter

Supported by Flutter Fix: no

The entire classes of BlacklistingTextInputFormatter and WhitelistingTextInoutFormatter were deprecated in v1.20.

Their functionality has been rewritten into a single class, FilteringTextInputFormatter.

Migration guide

Code before migration:

formatter = BlacklistingTextInputFormatter(pattern, replacementString: 'replacedPattern');
formatter = BlacklistingTextInputFormatter.singleLineFormatter;
pattern = formatter.blacklistedPattern;
formatter = WhitelistingTextInputFormatter(pattern);
formatter = WhitelistingTextInputFormatter.digitsOnly;
pattern = formatter.whitelistedPattern;

Code after migration:

formatter = FilteringTextInputFormatter.deny(pattern, replacementString: 'replacedPattern');
formatter = FilteringTextInputFormatter.singleLineFormatter;
pattern = formatter.filterPattern;
formatter = FilteringTextInputFormatter.allow(pattern);
formatter = FilteringTextInputFormatter.digitsOnly;
pattern = formatter.filterPattern;

References

API documentation:

Relevant PRs:


BottomNavigationBarItem.title

Supported by Flutter Fix: yes

The title of BottomNavigationBarItem was deprecated in v1.19. The label property should be used instead. This migration allows for better text scaling, and presents built-in Tooltips for the BottomNavigationBarItem in the context of a BottomNavigationBar.

Migration guide

In-depth migration guide available

Code before migration:

const BottomNavigationBarItem bottomNavigationBarItem = BottomNavigationBarItem(title: myTitle);
const BottomNavigationBarItem bottomNavigationBarItem = BottomNavigationBarItem();
bottomNavigationBarItem.title;

Code after migration:

const BottomNavigationBarItem bottomNavigationBarItem = BottomNavigationBarItem(label: myTitle);
const BottomNavigationBarItem bottomNavigationBarItem = BottomNavigationBarItem();
bottomNavigationBarItem.label;

References

Design Document

API documentation:

Relevant PRs:


Timeline

In stable release: TBD