LateInitializationError: Field has not been initialized Flutter / Dart Origin: On your device OSI layer 7 · Application Last updated 4 Nov 2026

Dart: LateInitializationError: Field 'controller' has not been initialized

A late variable was read before it was assigned.

Exact message you may see LateInitializationError: Field has not been initializedLateInitializationError: Local 'x' has not been initializedLateInitializationError: Field '_controller' has not been initializedLateInitializationError: Field 'x' has already been initialized
Seen on: Flutter

Meaning

late promises you will initialise a field before first use. Reading it earlier throws. Initialise it in initState, make it late final x = … with an initialiser (lazy), or make it nullable. Also happens when initState assigns after build already used it, or on hot reload of a field added later.

Common causes

  • late field read in build before initState assigns it
  • Assignment inside a branch that did not run
  • Async initialisation not finished
  • Hot reload added a late field to an existing State
  • Reading in a constructor initialiser

⚡ Quick fix

  1. Assign in initState before use
  2. Use a lazy initialiser: late final c = TextEditingController();
  3. Make the field nullable and handle null

Detailed fix by platform

Dart

  1. late final controller = TextEditingController(); with dispose() calling controller.dispose()

How to diagnose

  1. Assign — Where is it set?
  2. Order — Before first read?
  3. Hot reload — Restart app?

🔧 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 elementNon-nullable instance field must be initialized — Dart: Non-nullable instance field 'name' must be initialized. Try adding an initializer expression, or a generative constructor that initializes it, or mark it 'late' (Flutter / Dart)Non-nullable instance…Null check operator used on a null value — Dart/Flutter: Null check operator used on a null value (Flutter / Dart)Null check operator u…setState() called after dispose() — Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted) (Flutter / Dart)setState() called aft…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 getter/method isn't defined for the type — Dart: The getter 'name' isn't defined for the type 'User' / The method 'foo' isn't defined for the class (Flutter / Dart)The getter/method isn…The named parameter is required, but there's no corresponding argument — Dart: The named parameter 'key' is required, but there's no corresponding argument (Flutter / Dart)The named parameter i…The property/method can't be unconditionally accessed because the receiver can be null — Dart: The property 'length' can't be unconditionally accessed because the receiver can be 'null' (Flutter / Dart)The property/method c…LateIniti…

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.