Flutter material ui Migration, Move Off material.dart

Flutter material ui Migration, Move Off material.dart

Flutter 3.50 deprecates material.dart. We ran dart fix on a test app: what it changes, the 3 errors it leaves and the silent theme bug the bridge fixes.

By Bijay Ranjan Pati7 min read

Flutter 3.50, released on 11 November 2026, formally deprecates package:flutter/material.dart and cupertino.dart. Material and Cupertino widgets now live in two standalone packages on pub.dev, material_ui and cupertino_ui.

Flutter's official fix is one command: dart fix --apply --code=migrate_design_widgets. We ran it on Flutter 3.50.1 against a small app that depends on a package which hasn't migrated yet.

The takeaway? dart fix rewrites your imports, but it can't see packages that still use the old library, and one of those failures is completely silent.

Key Takeaways

  • Flutter 3.50 deprecates material.dart and cupertino.dart; no removal date has been announced. New projects from flutter create already import material_ui.
  • In our test, dart fix rewrote the imports and added material_ui: any to pubspec. It left three analyzer errors to fix by hand.
  • Without MaterialUiCompatibilityBridge, an unmigrated package lost the app theme with no analyzer warning. Adding the bridge fixed it, but the bridge can't fix types in a package's public API.

Is material.dart deprecated in Flutter 3.50?

Yes. The official breaking-change guide says the in-framework libraries were "formally deprecated in Flutter 3.50". Contributions to them had already been frozen since Flutter 3.44.

Deprecated isn't removed. Your app still builds, and flutter analyze reports each old import as an info-level deprecated_member_use hint. Oddly, on 3.50.1 the hint says the library was "deprecated after v3.47.0-0.0.pre". Flutter's decoupling announcement only promises removal "at a future date", so treat any article quoting a 2027 deadline with caution.

What changes now is where fixes land. New Material work, including the Material 3 updates covered in our Material 3 in Flutter post, ships in the package, not the SDK.

What are the material_ui and cupertino_ui packages?

They're the Material and Cupertino widget libraries, moved out of the Flutter SDK and published separately by the verified flutter.dev publisher. They follow semantic versioning and release on their own schedule, independent of Flutter releases.

material_uicupertino_ui
Replacespackage:flutter/material.dartpackage:flutter/cupertino.dart
Latest version (3 Dec 2026)1.12.01.1.7
Importpackage:material_ui/material_ui.dartpackage:cupertino_ui/cupertino_ui.dart
Bridge for old packagesMaterialUiCompatibilityBridgeCupertinoUiCompatibilityBridge
Best forAndroid-style and most cross-platform appsiOS-styled screens and widgets

The class names haven't changed, but the classes have. The guide is explicit that values from material.dart "cannot be assigned to parameters expecting types from package:material_ui". A ThemeData from one library isn't a ThemeData from the other.

How to migrate with dart fix migrate_design_widgets

Upgrade to Flutter 3.50, commit your work, then run dart fix --apply --code=migrate_design_widgets from the project root. The fix comes from the migrate_design_widgets lint, which arrived in Dart 3.13.

Our test app only used Material, so we haven't checked how the fix handles cupertino.dart. On our app it reported "3 fixes made in 3 files". This is the full change it made:

dart fix changes (from run-output.txt)

-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
+  material_ui: any
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';

It rewrote the imports in lib/ and test/, and added the dependency to pubspec.yaml. Other guides disagree on that last point, but in our run on 3.50.1, dart fix did edit pubspec. The first two lines above are from lib/main.dart, the third from pubspec.yaml and the last two from test/badge_test.dart.

However, it added material_ui: any, with no version constraint. Pub resolved 1.12.0 for us, but an unpinned dependency can jump a major version on a later pub upgrade. Replace it with a caret constraint such as ^1.12.0.

Why does flutter analyze fail after dart fix?

Because the fix only rewrites imports. Our app went from three info-level hints to three errors:

flutter analyze after dart fix (from run-output.txt)

error • The name 'GlobalMaterialLocalizations' is defined in the libraries 'package:flutter_localizations/src/material_localizations.dart (via package:flutter_localizations/flutter_localizations.dart)' and 'package:material_ui/src/global_material_localizations.dart (via package:material_ui/material_ui.dart)'. • ambiguous_import
error • The values in a const list literal must be constants. • non_constant_list_element
error • The argument type 'FloatingActionButtonLocation' can't be assigned to the parameter type 'FloatingActionButtonLocation?'.  • lib/main.dart:20:39 • argument_type_not_assignable

The first two errors come from one cause. flutter_localizations still exports its own GlobalMaterialLocalizations, so the name now exists twice. The guide's fix is to import only what you need from it:

lib/main.dart

import 'package:material_ui/material_ui.dart';
import 'package:flutter_localizations/flutter_localizations.dart'
    show GlobalWidgetsLocalizations;
import 'package:legacy_badge/legacy_badge.dart' show LegacyBadge;

The third error is the harder one. Our local legacy_badge package returns a FloatingActionButtonLocation from the old library, and the new Scaffold rejects it. The error message is confusing, because both types have the same name.

We fixed it by using the type from material_ui directly. With a real dependency, you'd wait for a migrated release, fork it, or replace it.

Five-step Flutter material_ui migration flow: upgrade to Flutter 3.50, run dart fix, pin the material_ui version, fix ambiguous imports and type errors, then audit packages and add the compatibility bridgeWhat if your packages still import material.dart?

This is where our test turned up a silent failure. Here's the unmigrated package we used. It reads the theme through the old Theme.of:

legacy_badge/lib/legacy_badge.dart

import 'package:flutter/material.dart';

/// Reads the theme with the old, in-framework Theme.of.

class LegacyBadge extends StatelessWidget {
  const LegacyBadge({super.key, required this.label});
  final String label;

  @override
  Widget build(BuildContext context) {
    final color = Theme.of(context).colorScheme.primary;
    return Container(key: const Key('badge'), color: color, child: Text(label));
  }
}

/// Exposes an in-framework Material type in its public API.

FloatingActionButtonLocation legacyFabLocation() =>
    FloatingActionButtonLocation.endFloat;

After our manual fixes, flutter analyze printed "No issues found!". Our widget test logs the badge colour without asserting it, so it still ran green. But the badge was painted Material's default purple (#6750A4) instead of our app's teal (#146683).

The reason is the type split. The app now provides a material_ui theme, and the old Theme.of can't see it, so it falls back to a default theme. Nothing warns you. You'd catch it only through golden tests, a widget test that asserts the colour, or by looking at the screen.

Step (Flutter 3.50.1)flutter analyzeBadge colour matches app theme?
Before migration3 info hintsYes
After dart fix3 errorsNot run (analyzer errors)
Manual fixes, no bridgeNo issuesNo: default purple
With MaterialUiCompatibilityBridgeNo issuesYes

How to use MaterialUiCompatibilityBridge

The bridge reads the new theme and localizations and republishes them for widgets that still use the old library. Put it in MaterialApp.builder so it wraps every route:

lib/main.dart

return MaterialApp(
  theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: seed)),
  localizationsDelegates: const [
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
  ],
  supportedLocales: const [Locale('en')],
  // Passes the new theme and localizations down to widgets that

  // still read them through package:flutter/material.dart.

  // ignore: deprecated_member_use

  builder: (context, child) => MaterialUiCompatibilityBridge(child: child!),
  // ...

With the bridge in place, our badge matched the app theme again. The bridge is deprecated on purpose, so you need the ignore comment, and it's meant to come out once your dependencies migrate.

It has a hard limit, though. The guide says it "cannot resolve type mismatches" when a package exposes old types in its public API. That's our FloatingActionButtonLocation error, and GitHub issue #191448 describes the same blocker in a production app.

Two-column diagram of what the Flutter compatibility bridge fixes, Theme.of and MaterialLocalizations.of lookups inside old packages, and what it can't fix, old Material types in a package's public APIDoes gen-l10n work with material_ui?

Not cleanly on 3.50.1. Issue #191072 reports that generated localisation files still use the deprecated delegates. That can cause "No MaterialLocalizations found" errors, and one commenter reports it breaks "for every locale except English".

A fix (PR #194500) merged on 23 November, after 3.50.1 shipped on 20 November. Until it reaches a stable release, the guide suggests spreading ...GlobalMaterialLocalizations.delegates from material_ui into your delegates list. We didn't test gen-l10n ourselves.

Should package authors release a major version?

Yes. The breaking-change guide tells authors to "treat this migration as a major version bump". A migrated package returns material_ui types, which breaks any app still on the old imports.

If you maintain internal packages, migrate them first, starting with the ones at the bottom of your dependency tree. Then your app can migrate in one pass.

What we don't know yet

There's no removal date for the old libraries, and no published timeline for when the bridges go away. We also don't know how quickly popular pub.dev packages will migrate. Run flutter pub deps and check each Material-dependent package's changelog before you plan the sprint.

Migration checklist for Flutter teams

  • Upgrade to Flutter 3.50 on a branch and run your full test suite first.
  • Run dart fix --apply --code=migrate_design_widgets, then run it once more, as the guide suggests.
  • Replace any any constraint that dart fix added (we saw material_ui: any) with a caret constraint.
  • Fix ambiguous_import errors with show GlobalWidgetsLocalizations.
  • List every dependency that imports material.dart, and add the bridge while any remain.
  • Add golden tests for screens that use third-party widgets, so theme fallbacks show up in CI.
  • Remove the bridge once every dependency has shipped a migrated release.

If you're also preparing store releases, our Flutter app store compliance checklist covers the 2027 Play and App Store deadlines.

How we checked this

We built a small Flutter 3.50.1 app (Dart 3.14.0, macOS) with a local package that still imports material.dart. We ran dart fix once, then flutter analyze at each step, and a widget test after each version that compiled. Every result above comes from that run, which used material_ui 1.12.0. Statements about removal plans, gen-l10n and package versioning come from Flutter's documentation and GitHub issues, linked inline.

Frequently Asked Questions

Is package:flutter/material.dart deprecated?

Yes, since Flutter 3.50 in November 2026. It still works, but flutter analyze flags every import, and new Material features ship only in material_ui.

Do I need to add material_ui to pubspec.yaml?

Yes, but dart fix did it for us. It added material_ui: any, so change that to a caret version. If it's missing, run flutter pub add material_ui.

What is MaterialUiCompatibilityBridge?

It's a temporary widget from material_ui that passes your theme and localizations to packages still using material.dart. Wrap your app with it in MaterialApp.builder. It doesn't fix type errors in package APIs.

Why is my theme ignored after migrating to material_ui?

Probably a dependency still reads the theme through the old Theme.of. It can't see your new theme, so it falls back to the default. Adding the compatibility bridge fixed this in our test.

When will material.dart be removed from Flutter?

Flutter hasn't announced a date. Its decoupling post only says the old libraries will be removed "at a future date", so plan the migration now rather than wait for a deadline.

Does Flutter 3.50 change Material 3 or my app's design?

Not on its own. The deprecation changes where the widgets come from, not how they look. Visual changes arrive through new material_ui releases, which you now control through pubspec.

Start with your dependency list

Before running any command, list your dependencies with flutter pub deps and count the ones that still import material.dart. That count tells you whether this is a one-hour change or a sprint. If you'd rather hand it off, our mobile app development team can build and maintain Flutter apps on the new packages. For the last big release before this one, see what changed in Flutter 3.32.

Written by

Bijay Ranjan PatiAuthor

More from Bijay

Published on

Got an Idea for a Digital Product?

We help you turn ideas into scalable, high-performing digital products using the right technology and strategy.

Let's get in touch

Whether you’re redesigning or starting fresh, we help you align in strategy,design,andtechnology.

What you get when you work with us

  • NDA signed before you share anything
  • We learn the business, not just the brief
  • Brainstorm directly with our founders
  • Progress you can see, daily and weekly
  • Pricing that stays honest as scope moves
Let’s work together
Rough notes are fine. We read every one.