Skip to content

First hot reload after flutter attach fails for an app built with flutter build ios --debug #195792

Closed

Description

@saibotma

Steps to reproduce

  1. flutter create --platforms ios --org com.example app && cd app
  2. Replace lib/main.dart with the code sample below.
  3. Build a debug app for the simulator: flutter build ios --simulator --debug
  4. Install it on a booted simulator: xcrun simctl install <udid> build/ios/iphonesimulator/Runner.app
  5. Start flutter attach -d <udid>, then launch the app: xcrun simctl launch <udid> com.example.app
  6. Change 'Hello' to 'Hello again' in lib/main.dart and press r.

Expected results

The text changes to "Hello again", as with flutter run.

Actual results

The app shows a red error screen with Lookup failed: _location. After one hot restart (R), hot reloads work.

flutter build ios has no --track-widget-creation option and writes TRACK_WIDGET_CREATION=false to ios/Flutter/Generated.xcconfig, while flutter attach defaults to --track-widget-creation. flutter build apk has the option and defaults it to on.

Attaching with flutter attach -d <udid> --no-track-widget-creation works around it. I'd expect flutter build ios --debug to track widget creation by default and accept --[no-]track-widget-creation like flutter build apk.

#109602 looks like the same mismatch for add-to-app modules built from Xcode, but I haven't confirmed that.

Code sample

import 'package:flutter/widgets.dart';

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return const Center(
      child: Text('Hello', textDirection: TextDirection.ltr),
    );
  }
}

Logs

Performing hot reload...

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _CompileTimeError was thrown building MyApp(dirty):
Lookup failed: _location in package:flutter/src/widgets/widget_inspector.dart in @fields in Widget
in package:flutter/src/widgets/framework.dart

Widget creation tracking is currently disabled. Enabling it enables improved error messages. It can
be enabled by passing `--track-widget-creation` to `flutter run` or `flutter test`.

When the exception was thrown, this was the stack:
#0      StatelessElement.build (package:flutter/src/widgets/framework.dart:5902:49)
#1      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5830:15)
#2      Element.rebuild (package:flutter/src/widgets/framework.dart:5542:7)
#3      BuildScope._tryRebuild (package:flutter/src/widgets/framework.dart:2763:15)
#4      BuildScope._flushDirtyElements (package:flutter/src/widgets/framework.dart:2820:11)
#5      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:3124:18)
...

Reloaded 1 of 533 libraries in 215ms (compile: 11 ms, reload: 31 ms, reassemble: 69 ms).

Flutter Doctor output

[✓] Flutter (Channel stable, 3.47.8, on macOS 26.6.1 25G76 darwin-arm64, locale en-DE)
[✓] Xcode - develop for iOS and macOS (Xcode 27.2)

Activity

  1. saurabh-mirajkar commented on Nov 3, 2026

    @saurabh-mirajkar
    Contributor

    @saibotma Thanks for the detailed report. I reproduced this on both Flutter 3.47.9 stable and Flutter 3.50 master using an iOS Simulator. Labelling and routing it to the iOS team for further investigation.

    Related: #109602

  2. added
    platform-iosiOS applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: hot reloadReloading code during "flutter run"
    a: buildBuilding flutter applications with the tool
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-iosOwned by iOS platform team
    and removed
    in triagePresently being triaged by the triage team
    on Nov 3, 2026
  3. added
    c: regressionIt was better in the past than it is now
    P1High-priority issues at the top of the work list
    team-toolOwned by Flutter Tool team
    fyi-iosFor the attention of iOS platform team
    triaged-iosTriaged by iOS platform team
    and removed
    team-iosOwned by iOS platform team
    on Nov 5, 2026
  4. cbracken commented on Nov 5, 2026

    @cbracken
    Member

    /cc @vashworth @bkonyi, while this appears to exist on stable, intuitively this seems like it's got to be a regression. Marked as P1 though feels like the case could be made for P2.

  5. added
    fyi-iosFor the attention of iOS platform team
    on Nov 5, 2026
  6. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    and removed
    P1High-priority issues at the top of the work list
    on Nov 6, 2026
  7. bkonyi commented on Nov 6, 2026

    @bkonyi
    Contributor

    Dropping to P2 since it looks like this has actually been an issue for years (it looks like it regressed after #56094).

    Fix is up for review: #196078.

  8. self-assigned this
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toolc: regressionIt was better in the past than it is nowfound in release: 3.47Found to occur in 3.47has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyt: hot reloadReloading code during "flutter run"team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions