question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flutter projects nested more than 2 levels deep do not force "Flutter mode", preventing launching/debugging apps

See original GitHub issue

Folder structure

  • /monorepo_root
    • apps
      • app1
        • lib/main.dart
      • app2
        • lib/main.dart

Works

  1. File > Open Folder (app1)
  2. Start Debugging

Doesn’t work

  1. File > Open Folder (monorepo_root)
  2. In Explorer right click on app1/lib/main.dart
  3. Select Start Debugging
lib/main.dart:1: Warning: Interpreting this as package URI, 'package:app1/main.dart'.
file:///C:/src/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/card_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/chip_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/colors.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color;
       ^
file:///C:/src/flutter/packages/flutter/lib/src/material/dialog_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
Exited (sigint)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Mar 25, 2019

Thanks for the update! I’ll keep this open because I think we should do a better job of guiding people here (the error when trying to run a Flutter project on the Dart VM is cryptic for one), even if it’s just detecting the failure and linking them to a page/issue that describes the above.

1reaction
DanTupcommented, Mar 21, 2019

This is expected right now. When deciding whether to load the Flutter SDK or Dart SDK, we look two levels down to see if there’s a Flutter project, and if not, we go into “Dart Mode”.

If you can’t open a folder closer to the apps, the best current fix is to click File -> Add Folder to Workspace and then select your app1/app2 folders which will show them in the Explorer tree as “Workspace Folders”. Unfortunately, this means they will appear in two places in the tree - there is a request to fix that in VS Code at https://github.com/Microsoft/vscode/issues/45470 (please add a 👍 ).

We could scan further down the tree looking for Flutter projects at startup, but it would slow down startup (significantly for those opening large trees) and doing it this way also prevents you from having your own settings/launch configs within each of the apps folders.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter's build modes
Describes Flutter's build modes and when you should use debug, release, or profile mode. ... The rest of the page goes into more...
Read more >
How do I debug a flutter app in vscode if the launch program is ...
This happens only when my main program is nested more than two levels deep.I have a deeply nested folder structure (given below). The...
Read more >
Restrictions on starting activities from the background
Android 10 (API level 29) and higher place restrictions on when apps can start activities when the app is running in the background....
Read more >
Flutter keep app running in background - cattolimonica.it
A plugin to keep flutter apps running in the background. ... Skil Running Flutter apps on Android is more perilous than you might...
Read more >
Flutter - Google Developers
With the release of Flutter 3 in May 2022, Flutter announced stable support for ... The most recent quarter was no exception —...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found