Skip to content

[material_ui] No migration path for dynamic_color because it exposes the legacy flutter/material.dart ColorScheme #191051

Closed

Description

@Predidit

Steps to reproduce

import 'package:dynamic_color/dynamic_color.dart';
import 'package:material_ui/material_ui.dart';

void main() {
  runApp(const ReproApp());
}

class ReproApp extends StatelessWidget {
  const ReproApp({super.key});

  @override
  Widget build(BuildContext context) {
    return DynamicColorBuilder(
      builder: (lightDynamic, darkDynamic) {
        return MaterialApp(
          theme: ThemeData(colorScheme: lightDynamic),
          darkTheme: ThemeData(colorScheme: darkDynamic),
          home: const Scaffold(
            body: Center(
              child: Text('dynamic_color + material_ui reproduction'),
            ),
          ),
        );
      },
    );
  }
}

Expected results

The application build success.

Actual results

The application fails static analysis.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.47.0, on Microsoft Windows [版本 10.0.26200.9168], locale zh-CN) [334ms]
    • Flutter version 3.47.0 on channel stable at D:\Dev\Environment\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cf2416426 (2 days ago), 2026-08-11 11:53:49 -0700
    • Engine revision 5f77625673
    • Dart version 3.13.0
    • DevTools version 2.60.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
      enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager,
      omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Windows Version (Windows 11 or higher, 25H2, 2009) [1,363ms]

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [9.0s]
    • Android SDK at C:\Users\admin\AppData\Local\Android\Sdk
    • Emulator version 36.6.11.0 (build_id 15507667) (CL:N/A)
    • Platform android-36.1, build-tools 36.1.0
    • ANDROID_HOME = C:\Users\admin\AppData\Local\Android\Sdk
    • ANDROID_SDK_ROOT = C:\Users\admin\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)
    • All Android licenses accepted.

[✓] Chrome - develop for the web [122ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio 生成工具 2026 18.6.2) [121ms]
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools
    • Visual Studio 生成工具 2026 version 18.6.11822.322
    • Windows 10 SDK version 10.0.26100.0

[✓] Connected device (3 available) [408ms]
    • Windows (desktop) • windows      • windows-x64    • Microsoft Windows [版本 10.0.26200.9168]
    • Chrome (web)      • chrome       • web-javascript • Google Chrome 151.0.7922.110
    • Edge (web)        • edge         • web-javascript • Microsoft Edge 150.0.4078.48

[✓] Network resources [1,889ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. saurabh-mirajkar commented on Aug 13, 2026

    @saurabh-mirajkar
    Contributor

    @Predidit Thanks for the report. Could you provide the complete code sample, full error logs and the dynamic_color and material_ui versions you're using?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    needs repro infoAutomated crash report whose cause isn't yet known
    and removed
    in triagePresently being triaged by the triage team
    on Aug 13, 2026
  3. Predidit commented on Aug 13, 2026

    @Predidit
    Author

    @saurabh-mirajkar

    Thanks for the follow up.

    The issue occurs during static analysis, before the application can be built or
    run, so there are no runtime logs. Below is the complete minimal reproduction,
    including its dependency versions.

    Tested versions:

    • Flutter: 3.47.0 stable
    • Dart: 3.13.0
    • dynamic_color: 1.9.0
    • material_ui: 1.0.0

    pubspec.yaml:

    name: dynamic_color_material_ui_repro
    description: "A new Flutter project."
    publish_to: none
    
    environment:
      sdk: ">=3.3.4 <4.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      dynamic_color: 1.9.0
      material_ui: 1.0.0

    lib/main.dart:

    import 'package:dynamic_color/dynamic_color.dart';
    import 'package:material_ui/material_ui.dart';
    
    void main() {
      runApp(const ReproApp());
    }
    
    class ReproApp extends StatelessWidget {
      const ReproApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return DynamicColorBuilder(
          builder: (lightDynamic, darkDynamic) {
            return MaterialApp(
              theme: ThemeData(colorScheme: lightDynamic),
              darkTheme: ThemeData(colorScheme: darkDynamic),
              home: const Scaffold(
                body: Center(
                  child: Text('dynamic_color + material_ui reproduction'),
                ),
              ),
            );
          },
        );
      }
    }

    Reproduction commands:

    flutter pub get
    flutter analyze
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 13, 2026
  5. saurabh-mirajkar commented on Aug 13, 2026

    @saurabh-mirajkar
    Contributor

    @Predidit Thanks for providing additional details. I was able to reproduce this on latest stable (3.47). Labeling this accordingly and passing it on for further triage.

    admin@Mac flutter_application_5 % flutter analyze 
    Analyzing flutter_application_5...                                      
    
      error • The argument type 'ColorScheme? (where ColorScheme is defined in
             /Users/admin/develop/flutter/packages/flutter/lib/src/material/color_scheme.dart)' can't be
             assigned to the parameter type 'ColorScheme? (where ColorScheme is defined in
             /Users/admin/.pub-cache/hosted/pub.dev/material_ui-1.0.0/lib/src/color_scheme.dart)'.  •
             lib/main.dart:16:41 • argument_type_not_assignable
      error • The argument type 'ColorScheme? (where ColorScheme is defined in
             /Users/admin/develop/flutter/packages/flutter/lib/src/material/color_scheme.dart)' can't be
             assigned to the parameter type 'ColorScheme? (where ColorScheme is defined in
             /Users/admin/.pub-cache/hosted/pub.dev/material_ui-1.0.0/lib/src/color_scheme.dart)'.  •
             lib/main.dart:17:45 • argument_type_not_assignable
    
    2 issues found. (ran in 1.9s)
  6. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-designOwned by Design Languages team
    and removed
    needs repro infoAutomated crash report whose cause isn't yet known
    on Aug 13, 2026
  7. Piinks commented on Aug 13, 2026

    @Piinks
    Contributor

    The compatibility bridge should be able to help with this, it will map over ThemeData properties to cover the gap for dependencies that have not migrated yet.

    dynamic_color needs to be migrated to use the new design packages, which will ultimately fix this.

  8. Predidit commented on Aug 14, 2026

    @Predidit
    Author

    @Piinks

    Thanks for the clarification.

    My understanding is that the compatibility bridge maps a modern
    material_ui.ThemeData to a legacy flutter/material.dart ThemeData for
    legacy widgets below the bridge. That works for dependencies which consume
    theme data from their surrounding widget tree.

    However, dynamic_color is different: the application does not provide a
    ColorScheme or ThemeData to it. Instead, DynamicColorBuilder produces and
    passes two legacy flutter/material.dart ColorScheme? values back to the
    application through its callback.

    I agree that migrating dynamic_color to the new design package would
    ultimately fix the issue. Alternatively, a temporary reverse conversion API
    from the legacy ColorScheme to material_ui.ColorScheme could provide a
    migration path.

    If there is another intended way to arrange the compatibility bridge so that it
    can convert values returned by DynamicColorBuilder, I would be happy to test
    it.

  9. Piinks commented on Aug 14, 2026

    @Piinks
    Contributor

    Hmm, this may be better filed in the dynamic_color issue tracker: https://github.com/material-foundation/flutter-packages/issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+
    The package itself is not currently owned or maintained by the Flutter team, and material_ui does not depend on it either.

  10. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 14, 2026
  11. Predidit commented on Aug 15, 2026

    @Predidit
    Author
  12. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 15, 2026
  13. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
  14. dkwingsmt commented on Aug 19, 2026

    @dkwingsmt
    Contributor

    In that case I'm closing this issue for now. Thanks for filing the issue there!

  15. github-actions commented on Sep 2, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.47Found to occur in 3.47has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions