The getter/method isn't defined for the type Flutter / Dart Origin: On your device Last updated 4 Nov 2026

Dart: The getter 'name' isn't defined for the type 'User' / The method 'foo' isn't defined for the class

The analyzer cannot find that property or method on the object's static type.

Exact message you may see The getter 'name' isn't defined for the type 'User'The method 'foo' isn't defined for the classThe named parameter 'x' isn't definedThe setter 'x' isn't defined for the typeUndefined name 'x'
Seen on: Flutter

Meaning

Typical reasons: a typo, the member was renamed in a package upgrade, the variable has type dynamic/Object and needs a cast, or you are missing an import or extension. Check autocomplete on the type and the package's changelog.

Common causes

  • Typo in the member name
  • Property removed/renamed in a newer package version
  • Object typed as Object/dynamic needing a cast
  • Missing import providing an extension
  • Using a widget parameter that doesn't exist in this Flutter version

⚡ Quick fix

  1. Check the class definition and spelling
  2. Read the package changelog after upgrades
  3. Cast: (obj as User).name or fix the declared type

Detailed fix by platform

Flutter

  1. flutter pub outdated and check CHANGELOG.md of the package that changed

How to diagnose

  1. Type — Static type of the receiver?
  2. Package — Upgraded recently?
  3. Import — Extension imported?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Bad state: No element — Dart: Bad state: No element — .first, .last or .single on an empty list (Flutter / Dart)Bad state: No elementBad state: Stream has already been listened to — Dart: Bad state: Stream has already been listened to (Flutter / Dart)Bad state: Stream has…Error: Couldn't resolve the package — Dart: Error: Couldn't resolve the package 'x' in 'package:x/x.dart' (Flutter / Dart)Error: Couldn't resol…FormatException: Unexpected character — Dart: FormatException: Unexpected character (at character 1) <!DOCTYPE html> — jsonDecode of an HTML page (Flutter / Dart)FormatException: Unex…Illegal argument in isolate message: object is unsendable — Dart: Invalid argument(s): Illegal argument in isolate message: object is unsendable - Library:'dart:async' Class: _Future@4048458 (Flutter / Dart)Illegal argument in i…LateInitializationError: Field has not been initialized — Dart: LateInitializationError: Field 'controller' has not been initialized (Flutter / Dart)LateInitializationErr…RangeError (index): Invalid value — Dart: RangeError (index): Invalid value: Valid value range is empty: 0 (Flutter / Dart)RangeError (index): I…The argument type can't be assigned to the parameter type — Dart: The argument type 'String?' can't be assigned to the parameter type 'String' (Flutter / Dart)The argument type can…The gette…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.