Skip to content

Migrate to material_ui, require Dart 3.12 / Flutter 3.44 (3.0.0) - #15

Merged
mvanbeusekom merged 8 commits into
mainfrom
r1ck3rt/fpl-58-material-ui-8b203f
Dec 1, 2026
Merged

mvanbeusekom merged 8 commits into
mainfrom
r1ck3rt/fpl-58-material-ui-8b203f

Conversation

@rickdijk

@rickdijk rickdijk commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • lib/** and example/lib/** import package:material_ui/material_ui.dart instead of package:flutter/material.dart. material_ui: ^1.0.0 added to both pubspecs.
  • lib/src/page.dart imports package:flutter/widgets.dart instead of the deprecated package:flutter/cupertino.dart (it only needs IconData and WidgetBuilder).
  • SDK floor raised to Dart ^3.12.0 / Flutter >=3.44.0 in pubspec.yaml and example/pubspec.yaml.
  • Version bumped to 3.0.0, CHANGELOG entry added, README updated (dependency snippet, SDK minimum, import note).
  • New widget test test/material_ui_compat_test.dart: pumps BaseflowPluginExample with one ExamplePage whose Scaffold holds a material_ui TextField and DropdownMenu, and asserts tester.takeException() is null.
  • dart format (Dart 3.12 tall style) applied in a separate commit.
  • Example Android project moved to the current Flutter template (Kotlin DSL, Gradle 9.9.2, AGP 9.3.1, Kotlin 2.4.20, Java 17), because CI's Java 25 can't run Gradle 7.6.3. applicationId/namespace unchanged; build apk --release passes on Flutter 3.44.9 and 3.50.1.
  • CHANGELOG: the dead medium.com link (403 to linkinator) in the 2.0.0-nullsafety entry now points to dart.dev/null-safety.

material_ui: ^1.0.0 is deliberate: 1.3.0 is the last release that allows Flutter 3.44; 1.4.0+ needs Flutter >=3.47 / Dart ^3.13. Pub picks the right one per SDK.

Why

Flutter 3.50.1 (current stable, used by CI) deprecates package:flutter/material.dart in favour of material_ui, which fails flutter analyze on the plugin examples (FPL-58, e.g. flutter-geocoding). Switching the examples' imports alone passes analyze but crashes at runtime with "No MaterialLocalizations found", because the template still built the legacy flutter MaterialApp, and material_ui widgets look up material_ui's localizations. MaterialUiCompatibilityBridge only bridges the other direction. So the template migrates first; the plugin examples follow on 3.0.0. The SDK floor follows the Baseflow-wide floor (FPL-48).

Breaking change for consumers

The public API now exposes material_ui types: BaseflowPluginExample builds a material_ui MaterialApp/ThemeData, and BaseflowPluginExample.createMaterialColor returns material_ui's MaterialColor. Examples on 3.0.0 must import package:material_ui/material_ui.dart (and add material_ui to their pubspec) instead of package:flutter/material.dart, and need Dart 3.12 / Flutter 3.44 or newer.

Verification

Check Flutter 3.44.9 Flutter 3.50.1
pub get ok (material_ui 1.2.0) ok
analyze No issues No issues
test 1/1 passed 1/1 passed
pub downgrade + analyze + test No issues, 1/1 passed (material_ui 1.0.0, url_launcher 6.3.0) –
dart format --set-exit-if-changed . – 0 changed
  • The new test fails on the old template (lib/ reverted to flutter/material.dart) with "No MaterialLocalizations found", so it covers the regression.
  • Not run locally: pub publish --dry-run (CI runs it).

Linear: FPL-58

🤖 Generated with Claude Code

rickdijk and others added 5 commits November 30, 2026 19:16
Replace package:flutter/material.dart with package:material_ui/material_ui.dart
in lib/ and the example, add material_ui ^1.0.0, and raise the SDK floor to
Dart ^3.12.0 / Flutter >=3.44.0 (FPL-48). The template now builds a material_ui
MaterialApp, so material_ui widgets inside example pages find their
MaterialLocalizations. Public types now come from material_ui, hence 3.0.0.

Adds a widget test that pumps BaseflowPluginExample with a material_ui
TextField and DropdownMenu; it fails with "No MaterialLocalizations found"
on 2.2.1.

Linear: FPL-58

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
package:flutter/cupertino.dart is deprecated since Flutter 3.47 in favour of
cupertino_ui; ExamplePage only needs IconData and WidgetBuilder, which
widgets.dart provides. Fixes the deprecated_member_use info on Flutter 3.50.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
medium.com answers 403 to bots, which fails the linkinator step in CI. Point the 2.0.0-nullsafety entry at dart.dev/null-safety instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's stable Flutter builds with Java 25, which Gradle 7.6.3 cannot run
("Unsupported class file major version 69"). Move the example's Android
project to the current Flutter template: Kotlin DSL build scripts,
Gradle 9.9.2, AGP 9.3.1, Kotlin 2.4.20, Java 17 target. applicationId and
namespace stay com.example.example. Builds with Flutter 3.44.9 and 3.50.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rickdijk
rickdijk marked this pull request as ready for review November 30, 2026 11:42
Comment thread lib/src/app.dart
import 'package:baseflow_plugin_template/src/info_page.dart';
import 'package:baseflow_plugin_template/src/page.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): an example that bumps to 3.0.0 but still builds its pages with package:flutter/material.dart widgets (TextField, DropdownMenu) compiles, then throws "No MaterialLocalizations found" when the page builds. BaseflowPluginExample.build now returns material_ui's MaterialApp, which registers only material_ui's localizations, and nothing bridges flutter widgets under a material_ui app. flutter analyze only shows deprecation infos, so the break shows up at runtime.

Fix: also pass flutter's DefaultMaterialLocalizations.delegate in localizationsDelegates so unmigrated examples keep working, or keep the break and make sure each plugin example changes its imports in the same PR as the bump.

Comment thread test/material_ui_compat_test.dart Resolved
Comment thread CHANGELOG.md Resolved

@rickdijk rickdijk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Criterion Verdict Reason
Real value pass Unblocks flutter analyze on Flutter 3.50 for every plugin example (FPL-58) and fixes the MaterialLocalizations crash that an import-only switch causes
Really fixes it pass All of lib/ moves to material_ui's MaterialApp; the new test reportedly fails on the old template. Not re-run in this review
Breaks something concern Intended and documented: material_ui types in the public API, new runtime dependency, SDK floor Dart 3.0 to 3.12 and Flutter 3.19 to 3.44. Unmigrated pages fail at runtime, not compile time (inline comment on lib/src/app.dart)
Version bump pass 3.0.0 is a major for a breaking change, above 2.2.1 on main and pub.dev, matches the top CHANGELOG heading. Headings carry no dates, so no date check. No other open PR claims a version
Tests concern Good regression test, but CI has no flutter test step, so it never runs there (inline comment on the test)
Contribution guidelines concern PR template not used, see below

Recommendation: comment. The change is sound and CI is green. Adding flutter test to CI and filling in the template would make this an approve.

  • The description drops the PR template: the "Pre-launch Checklist" is missing and no GitHub issue is linked. FPL-58 is a private Linear ticket, so outside contributors can't follow it. Restore the checklist and either link a public issue or summarise the problem without the ticket.
  • Scope: the material_ui migration, a repo-wide dart format, the Android Gradle/AGP/Kotlin DSL migration and a CHANGELOG link fix land together. The format and Android changes are needed for CI on current stable, and each sits in its own commit, so merge with a merge commit rather than squash to keep them apart in history.
  • Release: deploy runs on a v* tag. The last tag is v2.2.0 while pub.dev has 2.2.1, so tag v3.0.0 on the merge commit, and consider backfilling v2.2.1.

rickdijk and others added 3 commits December 1, 2026 00:35
Flutter rewrites analysis_options.yaml during `flutter test` to exclude
build/**. In CI that left a modified checked-in file, so the publish dry
run that follows the test step failed. Commit the rewritten file so the
tree stays clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Rick van Dijk <rickavdijk@gmail.com>

@mvanbeusekom mvanbeusekom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Rick

@rickdijk rickdijk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Already in the code before this PR, not blocking: BaseflowPluginExample's constructor (lib/src/app.dart:26) calls pages.add(InfoPage.createPage(...)) on the caller's list. Passing pages: const [...] throws "Cannot add to an unmodifiable list", and building the widget twice from the same list adds the Info page twice. Fix: pages = [...pages, InfoPage.createPage(pluginName, githubURL, pubDevURL)] in the initializer list. Fine as a follow-up PR.

@mvanbeusekom
mvanbeusekom merged commit b8bc36a into main Dec 1, 2026
3 checks passed
@rickdijk
rickdijk deleted the r1ck3rt/fpl-58-material-ui-8b203f branch December 1, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants