Skip to content

Flutter build errorFlutter: “Error: Member not found: ‘packageRoot’”

A Flutter build stops with Error: Member not found: ‘packageRoot’, pointing into a file under .pub-cache, usually lib/src/interface/local_platform.dart of package:platform. Dart 2.16 removed Platform.packageRoot, and versions of package:platform before 3.1.0 still read it. It shows up when an older project, or a package that pins an old platform version, is built with a newer Flutter.

Short answer

Upgrade package:platform to 3.1.0 or later: run flutter pub upgrade, and if pub keeps the old version, find the package that holds it back (flutter pub deps) and upgrade that package. As a last resort, add platform: ^3.1.0 under dependency_overrides.

Why the member is missing, and the fix

  1. 01

    An old package:platform with a newer Dart

    “The Platform.packageRoot API has been removed. It had been marked deprecated in 2018, as it doesn't work with any Dart 2.x release.” GitHub, Dart SDK 2.16.0 changelog

    package:platform wraps dart:io’s Platform class. Before 3.1.0 it still exposed packageRoot, which no longer exists in Dart, so the old version no longer compiles. Most projects get platform indirectly, through another package such as process.

    flutter pub upgrade
    flutter clean
    flutter pub deps | grep -E "(^|[ -])platform "   # check which version resolved
  2. 02

    A dependency that pins an old platform version

    “Removed Platform.packageRoot, which was already marked deprecated, and which didn't work in Dart 2.” pub.dev, package:platform 3.1.0 changelog

    If flutter pub upgrade leaves platform below 3.1.0, another package’s constraint holds it back. flutter pub outdated shows which; upgrade that package to a current version.

    flutter pub outdated
    # raise the package that holds platform back in pubspec.yaml, then:
    flutter pub get
  3. 03

    No newer version of that package exists

    “You can use dependency_overrides to temporarily override all references to a dependency.” Dart, Package dependencies

    For an abandoned package, a dependency override forces a newer platform. Treat it as a stopgap and plan to replace the abandoned package. If pub says platform needs SDK 2.12 or later, the project isn’t null safe yet: raise the SDK constraint and migrate it by hand first, because dart migrate no longer exists.

    # pubspec.yaml (stopgap only)
    dependency_overrides:
      platform: ^3.1.0

Checked against the vendor’s docs on : Dart SDK changelog (2.16.0: Platform.packageRoot removed); pub.dev: package:platform changelog (3.1.0); Dart: Package dependencies (dependency_overrides).

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Firebase “Member not found: verifyExtends” · Flutter pub “version solving failed” · Flutter “:app:compileFlutterBuildDebug” failed · flutter: command not found

Questions

More on this error

Can I just add // ignore: deprecated_member_use?

No. That comment only hides an analyzer warning. The member no longer exists, so the compiler fails regardless; the package has to be upgraded.

Why did it start after a Flutter upgrade?

Each Flutter release bundles a Dart version. Moving to a Flutter with Dart 2.16 or later (Flutter 2.10) removes Platform.packageRoot, and old package code that used it stops compiling.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.