What I'm doing here might not be very supported, but since the behaviour seemed strange I thought it was worth raising.
When VS Code has a Flutter project open it always uses the Dart SDK from the Flutter SDK. This means if we want to pub run build_runner watch
this (I know we probably want webdev
, but this was already here so I tried it) it'll use Flutter's version. I noticed a weird discrepancy when running pub run build_runner serve web
using this version of pub versus Dart v2.1 (the Dart one works, the Flutter one does not).
I don't know if this is an expected difference because it's in Flutter, or if something changed/broke between v2.1 and vMaster of Dart.
dantup-macbookpro:devtools dantup$ which pub
/Users/dantup/Dev/dart-sdk/v2.1/bin/pub
dantup-macbookpro:devtools dantup$ pub run build_runner serve web
[INFO] Generating build script completed, took 293ms
[INFO] Setting up file watchers completed, took 17ms
[INFO] Waiting for all file watchers to be ready completed, took 203ms
[INFO] Reading cached asset graph completed, took 383ms
[INFO] Checking for updates since last build completed, took 573ms
[INFO] Running build completed, took 15.8s
[INFO] Caching finalized dependency graph completed, took 170ms
[INFO] Succeeded after 16.0s with 217 outputs (151 actions)
Serving `web` on http://localhost:8080
dantup-macbookpro:devtools dantup$ /Users/dantup/Dev/Google/flutter/bin/cache/dart-sdk/bin/pub run build_runner serve web
[INFO] Generating build script completed, took 366ms
[INFO] Setting up file watchers completed, took 21ms
[INFO] Waiting for all file watchers to be ready completed, took 204ms
[WARNING] Throwing away cached asset graph due to Dart SDK update.
[INFO] Cleaning up outputs from previous builds. completed, took 229ms
[INFO] Reading cached asset graph completed, took 576ms
[INFO] Building new asset graph completed, took 1.2s
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[WARNING] build_modules|dartdevc on lib/.dartdevc.meta_module.raw:
Unable to read module information for package:flutter, make sure you have a dependency on it in your pubspec.
[SEVERE] build_web_compilers|ddc on package:vm_service_lib/vm_service_lib.dartdevc.module:
ProcessException: No such file or directory
Command: /Users/dantup/Dev/Google/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker
[SEVERE] build_web_compilers|ddc on package:meta/meta.dartdevc.module:
ProcessException: No such file or directory
Command: /Users/dantup/Dev/Google/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker
[SEVERE] build_web_compilers|ddc on package:intl/number_symbols.dartdevc.module:
ProcessException: No such file or directory
Command: /Users/dantup/Dev/Google/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker
[SEVERE] build_web_compilers|ddc on package:intl/date_symbols.dartdevc.module:
ProcessException: No such file or directory
Command: /Users/dantup/Dev/Google/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker
[WARNING] build_web_compilers|entrypoint on web/main.dart:
Unable to read intl|lib/date_symbols.ddc.js, check your console or the `.dart_tool/build/generated/intl/lib/date_symbols.ddc.js.errors` log file.
[WARNING] build_web_compilers|entrypoint on web/main.dart:
Unable to read vm_service_lib|lib/vm_service_lib.ddc.js, check your console or the `.dart_tool/build/generated/vm_service_lib/lib/vm_service_lib.ddc.js.errors` log file.
[WARNING] build_web_compilers|entrypoint on web/main.dart:
Unable to read intl|lib/number_symbols.ddc.js, check your console or the `.dart_tool/build/generated/intl/lib/number_symbols.ddc.js.errors` log file.
[WARNING] build_web_compilers|entrypoint on web/main.dart:
Unable to read meta|lib/meta.ddc.js, check your console or the `.dart_tool/build/generated/meta/lib/meta.ddc.js.errors` log file.
[WARNING] No actions completed for 15.1s, waiting on:
- build_web_compilers|ddc on package:path/path.dartdevc.module
- build_web_compilers|ddc on package:intl/number_symbols_data.dartdevc.module
- build_web_compilers|ddc on package:intl/src/plural_rules.dartdevc.module
- build_web_compilers|ddc on package:intl/intl.dartdevc.module
- build_web_compilers|ddc on package:collection/src/utils.dartdevc.module
.. and 12 more
[WARNING] No actions completed for 15.1s, waiting on:
- build_web_compilers|ddc on package:path/path.dartdevc.module
- build_web_compilers|ddc on package:intl/number_symbols_data.dartdevc.module
- build_web_compilers|ddc on package:intl/src/plural_rules.dartdevc.module
- build_web_compilers|ddc on package:intl/intl.dartdevc.module
- build_web_compilers|ddc on package:collection/src/utils.dartdevc.module
.. and 12 more