Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4862 pages

Upgrades and deprecations

Flutter material_ui and cupertino_ui Standalone Packages Migration: Imports, Bridge and Localizations

In short

The Flutter material_ui and cupertino_ui standalone packages migration swaps package:flutter/material.dart and cupertino.dart for two pub.dev packages. Flutter 3.50 formally deprecated the bundled libraries. Run dart fix --apply --code=migrate_design_widgets, add the packages if the fix does not, update localization delegates, and use the compatibility bridge while dependencies catch up.

What moved, and on which Flutter releases

Material and Cupertino used to ship inside the Flutter SDK, so every widget fix waited for an SDK release. The Flutter migration guide gives three reasons for the split: fixes that waited for quarterly releases, slower contributions, and apps that could not update the design libraries on their own. The packages now live in the flutter/packages repository, and the guide says weekly releases are planned.

The Flutter blog post of 7 April 2026 announced the freeze: contributions to Material and Cupertino in flutter/flutter stopped, and the frozen copy is what you get on Flutter 3.44 or later. That post asked most developers to wait for migration instructions, and those arrived with 3.50.

Flutter releaseWhat happened to Material and Cupertino
3.44Contributions to the in-SDK libraries frozen
3.47 (12 August 2026)Version 1.0 of `material_ui` and `cupertino_ui` published on pub.dev; apps can opt in
3.50 (11 November 2026)In-framework libraries formally deprecated; migration guide published
RemovalNo version or date stated in the guide; the packages follow semantic versioning

Checked against: source 1, source 2, source 5

How to migrate to material_ui and cupertino_ui with dart fix

The guide's automated route is one command, run from the app's root, followed by a second plain dart fix pass for the follow-on fixes and lint warnings such as import sorting. The full sequence is the short block at the end of this section; what it changes is listed first.

  • Before: import 'package:flutter/material.dart'; and import 'package:flutter/cupertino.dart';.
  • After: import 'package:material_ui/material_ui.dart'; and import 'package:cupertino_ui/cupertino_ui.dart';.
  • The guide notes that dart fix may leave pubspec.yaml alone, which is why the two flutter pub add lines exist. A missing dependency shows up as an unresolved import; the Target of URI doesn't exist page covers that message.
  • On 29 November 2026 pub.dev listed material_ui 1.11.1 and cupertino_ui 1.1.7, both from the verified flutter.dev publisher. Expect those numbers to move often if the weekly plan holds.
dart fix --apply --code=migrate_design_widgets
flutter pub add material_ui      # only if dart fix did not add it
flutter pub add cupertino_ui     # only if you use Cupertino widgets
dart fix --apply

Checked against: source 1, source 3, source 4

The ambiguous import trap with flutter_localizations

This is the step most likely to break a build after the fix runs. The guide explains that dart fix adds the new imports but leaves package:flutter_localizations/flutter_localizations.dart in place. That library still exports its own deprecated GlobalMaterialLocalizations and GlobalCupertinoLocalizations, so any file that imports both gets an ambiguous_import error where those names appear.

Two ways out, both from the guide. If a file still needs GlobalWidgetsLocalizations, narrow the old import with show GlobalWidgetsLocalizations. Otherwise drop it and set localizationsDelegates: GlobalMaterialLocalizations.delegates from material_ui, which the guide says brings in the Cupertino and Widgets delegates as well. A Cupertino only app can use GlobalCupertinoLocalizations.delegates from cupertino_ui; a CupertinoApp that also shows Material widgets needs the Material list or it fails with No MaterialLocalizations found.

Apps that use flutter gen-l10n hit one more gap. In 3.50 the generator still writes code against the deprecated delegates. Until the fix tracked in Flutter issue 191072 reaches stable, the guide's workaround is to build the delegate list by hand, with your AppLocalizations.delegate first and the spread GlobalMaterialLocalizations.delegates after it, and to add header: '// ignore_for_file: deprecated_member_use' to l10n.yaml, removed again once the fixed release lands.

Checked against: source 1

What MaterialUiCompatibilityBridge does in the standalone packages migration

Your own code can switch in an afternoon, but third party packages may still import package:flutter/material.dart. For that window, material_ui ships MaterialUiCompatibilityBridge and cupertino_ui ships CupertinoUiCompatibilityBridge. You return the bridge from MaterialApp.builder (or CupertinoApp.builder), wrapping the child, or wrap only the subtree that holds the old widgets.

The bridge pushes theme and localization data down the tree, so unmigrated widgets that call Theme.of(context) or MaterialLocalizations.of(context) keep working. It is deprecated by design, so it raises deprecated_member_use; the guide silences that with an ignore comment and says to remove the bridge once your dependencies move.

Its limit is types. When a dependency takes or returns SDK design types in its public API, such as a ColorScheme, a TextTheme or a FloatingActionButtonLocation, the bridge cannot fix the mismatch, and that dependency has to migrate before you can pass it the new types. Before starting, I would list every package in pubspec.yaml that exposes theme or color parameters, since those are the ones that can block you.

Checked against: source 1, source 3, source 4

Material and Cupertino as standalone packages: advice for package authors

If you publish a Flutter package, the guide says to treat the switch as a major version bump. Class names stay the same, but they now come from a different library, so a consumer who has not migrated would break. The semantic version calculator can confirm which number your next release should carry.

A sensible order from the guide's wording: release the migrated package as a new major, tell users which Flutter release they need, and keep the old major alive for apps still on the bundled libraries.

Checked against: source 1

A checklist for the standalone packages migration, and the separate Gradle change

Built from the guide, in the order I would run it on an app:

  • Upgrade to Flutter 3.50, run the dart fix command, then run dart fix --apply again.
  • Confirm material_ui and, if used, cupertino_ui are in pubspec.yaml.
  • Search for flutter_localizations imports and fix any ambiguous_import errors.
  • Switch to the new delegate lists; apply the gen-l10n workaround if you generate localizations.
  • Add the compatibility bridge only if a dependency still imports the old libraries, and note which one so you can remove it later.
  • Build each platform and run your widget tests.
  • Do not confuse this with the Android build change in the same period. The built-in Kotlin guide says Android Gradle Plugin 9 makes built-in Kotlin the default, that Flutter 3.44 kept the legacy Kotlin Gradle Plugin working with android.builtInKotlin=false, and that 3.47 allows android.builtInKotlin=true once every plugin has migrated. It has nothing to do with widgets; the common build failure is under Kotlin source sets not allowed with built-in Kotlin.
  • The iOS side has its own move this year, from CocoaPods to SwiftPM, in the Flutter Swift Package Manager migration. Android release deadlines are in the Play target API level 36 dates, and the full list is on the upgrades hub. The facts here were read on 29 November 2026; recheck the guide for a removal date and for the gen-l10n fix in later releases.

Checked against: source 1, source 2, source 6

What else do people ask?

Is package:flutter/material.dart removed in Flutter 3.50?

No. It is formally deprecated in 3.50. The migration guide gives no removal version or date.

What is the dart fix code for the material_ui migration?

dart fix --apply --code=migrate_design_widgets. It rewrites the imports; add the packages with flutter pub add if it does not.

Why do I get ambiguous_import after migrating to material_ui?

flutter_localizations still exports deprecated GlobalMaterialLocalizations and GlobalCupertinoLocalizations. Narrow that import with show GlobalWidgetsLocalizations or remove it.

Can I migrate before my dependencies move to the standalone packages?

Yes, with MaterialUiCompatibilityBridge or CupertinoUiCompatibilityBridge in your app's builder. It does not help when a dependency passes SDK design types such as ColorScheme through its public API.

Should a package author release the cupertino_ui switch as a minor version?

The guide says to treat it as a major version bump, because consumers who have not migrated would break.

Sources

Keep reading

Next step

Have a project in mind?

Tell me about it. A discovery call within 48 hours.