dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.04k stars 1.55k forks source link

[Dart2Wasm] Error root cause is obscured by stacktrace #55033

Open itsjustkevin opened 6 months ago

itsjustkevin commented 6 months ago

Dart2Wasm errors are not easily visible.

Background

When attempting a Flutter Wasm build while utilizing a plugin or package that is not yet migrated, the error logged before logging the offending error in the package/plugin, followed by the stack trace.

This makes it difficult to immediately understand what the issue is.

Expectation

I would expect that the error is logged at the end.

Error log

Wasm build error log
➜ wasm_test flutter build web --wasm ┌─ Experimental feature ───────────────────────────────┐ │ WebAssembly compilation is experimental. │ │ See https://flutter.dev/wasm for more information. │ └──────────────────────────────────────────────────────┘ Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64: *NOTE*: Compilation to WasmGC is experimental. The support may change, or be removed, with no advance notice. ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:6:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ Context: The unavailable library 'dart:html' is imported through these packages: web_plugin_registrant.dart => package:camera_web => dart:html Detailed import paths for (some of) the these imports: main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/camera_service.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera_service.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:6:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:5:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:5:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/zoom_level_capability.dart:5:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:61:37: Error: Type 'html.Event' not found. final Map> ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:64:37: Error: Type 'html.Event' not found. final Map> ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:67:37: Error: Type 'html.MediaStreamTrack' not found. final Map> ^^^^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:71:37: Error: Type 'html.ErrorEvent' not found. final Map> ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:82:3: Error: Type 'html.Window' not found. html.Window? window = html.window; ^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:661:10: Error: Type 'html.MediaStream' not found. Future _getVideoStreamForDevice( ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:62:14: Error: Type 'html.VideoElement' not found. late final html.VideoElement videoElement; ^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:67:14: Error: Type 'html.DivElement' not found. late final html.DivElement divElement; ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:71:3: Error: Type 'html.MediaStream' not found. html.MediaStream? stream; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:81:10: Error: Type 'html.MediaStreamTrack' not found. Stream get onEnded => onEndedController.stream; ^^^^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:85:26: Error: Type 'html.MediaStreamTrack' not found. final StreamController onEndedController = ^^^^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:88:22: Error: Type 'html.Event' not found. StreamSubscription? _onEndedSubscription; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:97:10: Error: Type 'html.ErrorEvent' not found. Stream get onVideoRecordingError => ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:102:26: Error: Type 'html.ErrorEvent' not found. final StreamController videoRecordingErrorController = ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:105:22: Error: Type 'html.Event' not found. StreamSubscription? _onVideoRecordingErrorSubscription; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:116:3: Error: Type 'html.Window' not found. html.Window? window = html.window; ^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:120:3: Error: Type 'html.MediaRecorder' not found. html.MediaRecorder? mediaRecorder; ^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:128:14: Error: Type 'html.Blob' not found. final List _videoData = []; ^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:134:17: Error: Type 'html.Event' not found. void Function(html.Event)? _videoDataAvailableListener; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:137:17: Error: Type 'html.Event' not found. void Function(html.Event)? _videoRecordingStoppedListener; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:144:3: Error: Type 'html.Blob' not found. html.Blob Function(List blobs, String type) blobBuilder = ^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:144:27: Error: Type 'html.Blob' not found. html.Blob Function(List blobs, String type) blobBuilder = ^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:486:5: Error: Type 'html.Event' not found. html.Event event, [ ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:504:5: Error: Type 'html.Event' not found. html.Event event, [ ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:632:33: Error: Type 'html.VideoElement' not found. void _applyDefaultVideoStyles(html.VideoElement element) { ^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:23:3: Error: Type 'html.Window' not found. html.Window? window = html.window; ^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:31:10: Error: Type 'html.MediaStream' not found. Future getMediaStreamForOptions( ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:183:38: Error: Type 'html.MediaStreamTrack' not found. String? getFacingModeForVideoTrack(html.MediaStreamTrack videoTrack) { ^^^^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:81:41: Error: Type 'html.MediaError' not found. static CameraErrorCode fromMediaError(html.MediaError error) { ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/zoom_level_capability.dart:33:9: Error: Type 'html.MediaStreamTrack' not found. final html.MediaStreamTrack videoTrack; ^^^^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:61:42: Error: 'Event' isn't a type. final Map> ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:62:70: Error: 'Event' isn't a type. _cameraVideoErrorSubscriptions = >{}; ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:64:42: Error: 'Event' isn't a type. final Map> ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:65:70: Error: 'Event' isn't a type. _cameraVideoAbortSubscriptions = >{}; ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:67:42: Error: 'MediaStreamTrack' isn't a type. final Map> ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:69:37: Error: 'MediaStreamTrack' isn't a type. >{}; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:71:42: Error: 'ErrorEvent' isn't a type. final Map> ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:73:37: Error: 'ErrorEvent' isn't a type. >{}; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:82:8: Error: 'Window' isn't a type. html.Window? window = html.window; ^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:82:30: Error: Undefined name 'window'. html.Window? window = html.window; ^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:87:18: Error: 'MediaDevices' isn't a type. final html.MediaDevices? mediaDevices = window?.navigator.mediaDevices; ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:100:18: Error: 'MediaStream' isn't a type. final html.MediaStream cameraStream = ^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:106:26: Error: 'MediaStreamTrack' isn't a type. .forEach((html.MediaStreamTrack videoTrack) => videoTrack.stop()); ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:112:27: Error: 'MediaDeviceInfo' isn't a type. final Iterable videoInputDevices = devices ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:113:27: Error: 'MediaDeviceInfo' isn't a type. .whereType() ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:114:24: Error: 'MediaDeviceInfo' isn't a type. .where((html.MediaDeviceInfo device) => ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:120:19: Error: 'MediaDeviceInfo' isn't a type. (html.MediaDeviceInfo device) => ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:125:23: Error: 'MediaDeviceInfo' isn't a type. for (final html.MediaDeviceInfo videoInputDevice in videoInputDevices) { ^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:128:20: Error: 'MediaStream' isn't a type. final html.MediaStream videoStream = await _getVideoStreamForDevice( ^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:134:25: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:175:27: Error: 'MediaStreamTrack' isn't a type. for (final html.MediaStreamTrack videoTrack in videoTracks) { ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:185:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:266:52: Error: 'Event' isn't a type. camera.videoElement.onError.listen((html.Event _) { ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:270:20: Error: 'MediaError' isn't a type. final html.MediaError error = camera.videoElement.error!; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:286:52: Error: 'Event' isn't a type. camera.videoElement.onAbort.listen((html.Event _) { ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:300:39: Error: 'MediaStreamTrack' isn't a type. camera.onEnded.listen((html.MediaStreamTrack _) { ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:321:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:361:16: Error: 'ScreenOrientation' isn't a type. final html.ScreenOrientation? orientation = window?.screen?.orientation; ^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:366:18: Error: 'Event' isn't a type. final html.Event initialOrientationEvent = html.Event('change'); ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:366:55: Error: Method not found: 'Event'. final html.Event initialOrientationEvent = html.Event('change'); ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:369:15: Error: 'Event' isn't a type. (html.Event _) { ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:386:18: Error: 'ScreenOrientation' isn't a type. final html.ScreenOrientation? screenOrientation = ^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:388:18: Error: 'Element' isn't a type. final html.Element? documentElement = window?.document.documentElement; ^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:407:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:415:18: Error: 'ScreenOrientation' isn't a type. final html.ScreenOrientation? orientation = window?.screen?.orientation; ^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:416:18: Error: 'Element' isn't a type. final html.Element? documentElement = window?.document.documentElement; ^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:426:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:435:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:467:53: Error: 'ErrorEvent' isn't a type. camera.onVideoRecordingError.listen((html.ErrorEvent errorEvent) { ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:477:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:492:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:504:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:516:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:528:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:580:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:592:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:604:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:618:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:627:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:655:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:62:19: Error: 'VideoElement' isn't a type. late final html.VideoElement videoElement; ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:67:19: Error: 'DivElement' isn't a type. late final html.DivElement divElement; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:71:8: Error: 'MediaStream' isn't a type. html.MediaStream? stream; ^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:85:31: Error: 'MediaStreamTrack' isn't a type. final StreamController onEndedController = ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:86:29: Error: 'MediaStreamTrack' isn't a type. StreamController.broadcast(); ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:88:27: Error: 'Event' isn't a type. StreamSubscription? _onEndedSubscription; ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:102:31: Error: 'ErrorEvent' isn't a type. final StreamController videoRecordingErrorController = ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:103:29: Error: 'ErrorEvent' isn't a type. StreamController.broadcast(); ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:105:27: Error: 'Event' isn't a type. StreamSubscription? _onVideoRecordingErrorSubscription; ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:116:8: Error: 'Window' isn't a type. html.Window? window = html.window; ^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:116:30: Error: Undefined name 'window'. html.Window? window = html.window; ^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:120:8: Error: 'MediaRecorder' isn't a type. html.MediaRecorder? mediaRecorder; ^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:125:12: Error: Undefined name 'MediaRecorder'. html.MediaRecorder.isTypeSupported; ^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:128:19: Error: 'Blob' isn't a type. final List _videoData = []; ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:128:44: Error: 'Blob' isn't a type. final List _videoData = []; ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:134:22: Error: 'Event' isn't a type. void Function(html.Event)? _videoDataAvailableListener; ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:137:22: Error: 'Event' isn't a type. void Function(html.Event)? _videoRecordingStoppedListener; ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:144:8: Error: 'Blob' isn't a type. html.Blob Function(List blobs, String type) blobBuilder = ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:144:32: Error: 'Blob' isn't a type. html.Blob Function(List blobs, String type) blobBuilder = ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:145:18: Error: 'Blob' isn't a type. (List blobs, String type) => html.Blob(blobs, type); ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:145:52: Error: Method not found: 'Blob'. (List blobs, String type) => html.Blob(blobs, type); ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:165:25: Error: Method not found: 'VideoElement'. videoElement = html.VideoElement(); ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:167:23: Error: Method not found: 'DivElement'. divElement = html.DivElement() ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:184:21: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = stream!.getVideoTracks(); ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:187:18: Error: 'MediaStreamTrack' isn't a type. final html.MediaStreamTrack defaultVideoTrack = videoTracks.first; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:189:69: Error: 'Event' isn't a type. _onEndedSubscription = defaultVideoTrack.onEnded.listen((html.Event _) { ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:216:21: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = stream!.getVideoTracks(); ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:221:21: Error: 'MediaStreamTrack' isn't a type. final List? tracks = stream?.getTracks(); ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:223:23: Error: 'MediaStreamTrack' isn't a type. for (final html.MediaStreamTrack track in tracks) { ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:245:16: Error: 'CanvasElement' isn't a type. final html.CanvasElement canvas = ^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:246:14: Error: Method not found: 'CanvasElement'. html.CanvasElement(width: videoWidth, height: videoHeight); ^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:259:16: Error: 'Blob' isn't a type. final html.Blob blob = await canvas.toBlob('image/jpeg'); ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:265:23: Error: Undefined name 'Url'. return XFile(html.Url.createObjectUrl(blob)); ^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:273:21: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:274:59: Error: 'MediaStreamTrack' isn't a type. videoElement.srcObject?.getVideoTracks() ?? []; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:280:16: Error: 'MediaStreamTrack' isn't a type. final html.MediaStreamTrack defaultVideoTrack = videoTracks.first; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:306:16: Error: 'MediaDevices' isn't a type. final html.MediaDevices? mediaDevices = window?.navigator.mediaDevices; ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:332:21: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:333:43: Error: 'MediaStreamTrack' isn't a type. stream?.getVideoTracks() ?? []; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:336:18: Error: 'MediaStreamTrack' isn't a type. final html.MediaStreamTrack defaultVideoTrack = videoTracks.first; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:410:21: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:411:59: Error: 'MediaStreamTrack' isn't a type. videoElement.srcObject?.getVideoTracks() ?? []; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:417:16: Error: 'MediaStreamTrack' isn't a type. final html.MediaStreamTrack defaultVideoTrack = videoTracks.first; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:449:14: Error: Method not found: 'MediaRecorder'. html.MediaRecorder(videoElement.srcObject!, { ^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:456:15: Error: 'Event' isn't a type. (html.Event event) => _onVideoDataAvailable(event, maxVideoDuration); ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:459:15: Error: 'Event' isn't a type. (html.Event event) => _onVideoRecordingStopped(event, maxVideoDuration); ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:472:45: Error: 'Event' isn't a type. mediaRecorder!.onError.listen((html.Event event) { ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:473:18: Error: 'ErrorEvent' isn't a type. final html.ErrorEvent error = event as html.ErrorEvent; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:473:51: Error: 'ErrorEvent' isn't a type. final html.ErrorEvent error = event as html.ErrorEvent; ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:486:10: Error: 'Event' isn't a type. html.Event event, [ ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:489:16: Error: 'Blob' isn't a type. final html.Blob? blob = (event as html.BlobEvent).data; ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:489:44: Error: 'BlobEvent' isn't a type. final html.Blob? blob = (event as html.BlobEvent).data; ^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:504:10: Error: 'Event' isn't a type. html.Event event, [ ^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:510:18: Error: 'Blob' isn't a type. final html.Blob videoBlob = blobBuilder(_videoData, videoType); ^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:514:14: Error: Undefined name 'Url'. html.Url.createObjectUrl(videoBlob), ^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:632:38: Error: 'VideoElement' isn't a type. void _applyDefaultVideoStyles(html.VideoElement element) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:23:8: Error: 'Window' isn't a type. html.Window? window = html.window; ^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:23:30: Error: Undefined name 'window'. html.Window? window = html.window; ^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:35:16: Error: 'MediaDevices' isn't a type. final html.MediaDevices? mediaDevices = window?.navigator.mediaDevices; ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:49:15: Error: 'DomException' isn't a type. } on html.DomException catch (e) { ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:123:16: Error: 'MediaDevices' isn't a type. final html.MediaDevices? mediaDevices = window?.navigator.mediaDevices; ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:138:21: Error: 'MediaStreamTrack' isn't a type. final List videoTracks = ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:139:50: Error: 'MediaStreamTrack' isn't a type. camera.stream?.getVideoTracks() ?? []; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:142:18: Error: 'MediaStreamTrack' isn't a type. final html.MediaStreamTrack defaultVideoTrack = videoTracks.first; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:183:43: Error: 'MediaStreamTrack' isn't a type. String? getFacingModeForVideoTrack(html.MediaStreamTrack videoTrack) { ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:184:16: Error: 'MediaDevices' isn't a type. final html.MediaDevices? mediaDevices = window?.navigator.mediaDevices; ^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:81:46: Error: 'MediaError' isn't a type. static CameraErrorCode fromMediaError(html.MediaError error) { ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:83:17: Error: Undefined name 'MediaError'. case html.MediaError.MEDIA_ERR_ABORTED: ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:85:17: Error: Undefined name 'MediaError'. case html.MediaError.MEDIA_ERR_NETWORK: ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:87:17: Error: Undefined name 'MediaError'. case html.MediaError.MEDIA_ERR_DECODE: ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:89:17: Error: Undefined name 'MediaError'. case html.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED: ^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/zoom_level_capability.dart:33:14: Error: 'MediaStreamTrack' isn't a type. final html.MediaStreamTrack videoTrack; ^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/shims/dart_js_util.dart:5:1: Error: JS interop library 'dart:js_util' can't be imported when compiling to Wasm. Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead. import 'dart:js_util' as js_util; ^ Command: /Users/kevinjchisholm/development/flutter/bin/cache/dart-sdk/bin/dart compile wasm --packages=.dart_tool/package_config.json --extra-compiler-option=--dart-sdk=/Users/kevinjchisholm/development/flutter/bin/cache/dart-sdk --extra-compiler-option=--platform=/Users/kevinjchisholm/development/flutter/bin/cache/flutter_web_sdk/kernel/dart2wasm_platform.dill --extra-compiler-option=--import-shared-memory --extra-compiler-option=--shared-memory-max-pages=32768 -Ddart.vm.product=true -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/0bc21ea7bc92600702cfd47b69ff9c3825b0fd81/ -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false -DFLUTTER_WEB_USE_SKWASM=true --extra-compiler-option=--depfile=/Users/kevinjchisholm/programming/wasm_test/.dart_tool/flutter_build/e63d6dd560aa7d1f8e8cde00c0d239dd/dart2wasm.d -O4 --no-name-section -o /Users/kevinjchisholm/programming/wasm_test/.dart_tool/flutter_build/e63d6dd560aa7d1f8e8cde00c0d239dd/main.dart.wasm /Users/kevinjchisholm/programming/wasm_test/.dart_tool/flutter_build/e63d6dd560aa7d1f8e8cde00c0d239dd/main.dart #0 RunResult.throwException (package:flutter_tools/src/base/process.dart:127:5) #1 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:326:19) #2 Dart2WasmTarget.build (package:flutter_tools/src/build_system/targets/web.dart:293:5) #3 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9) #4 Future.wait. (dart:async/future.dart:524:21) #5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32) #6 Future.wait. (dart:async/future.dart:524:21) #7 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32) #8 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:642:16) #9 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:91:34) #10 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:237:5) #11 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1394:27) #12 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #13 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #14 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:360:9) #15 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:300:5) #17 run.. (package:flutter_tools/runner.dart:119:9) #18 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #19 main (package:flutter_tools/executable.dart:94:3) Compiling lib/main.dart for the Web... 14.6s Error: Failed to compile application for the Web.

System

dart-github-bot commented 6 months ago
Item Details
Summary Dart2Wasm error messages are not easily visible.
Triage to area-dart2wasm

(what's this?)

mkustermann commented 6 months ago

This looks more like a CFE issue.

Also for most compilers one wants to look at the very first error, which is pretty clear

┌─ Experimental feature ───────────────────────────────┐
│ WebAssembly compilation is experimental. │
│ See https://flutter.dev/wasm for more information. │
└──────────────────────────────────────────────────────┘

Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64:
NOTE: Compilation to WasmGC is experimental.
The support may change, or be removed, with no advance notice.

../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:6:8: Error: Dart library 'dart:html' is not available on this platform.
import 'dart:html' as html;
^
Context: The unavailable library 'dart:html' is imported through these packages:

Because following errors are usually consequences of the first.

johnniwinther commented 5 months ago

As far as I can see the first error is the root cause (dart:html not being available).

@itsjustkevin What (other?) result would you have preferred in this case?

itsjustkevin commented 5 months ago

@johnniwinther this may be a special case, due to the fact that dart:html is not WASM compatible, that I am looking at from a user perspective.

As a user attempting a Wasm build of my Flutter app, I might have thousands of lines of errors returned, making it difficult for me to hunt for the issues.

For the users, it may be helpful to append the offending libraries to the output:

The following libraries are unavailable:
dart:html
dart:convert
dart:math