Questions tagged [dart-dev-compiler]

The Dart Dev Compiler (DDC) is a development tool and transpiler. It is at a very early stage today. Its aims include the following:

  • A static checker based on stricter-than-standard-Dart type rules.
  • A modular Dart-to-ES6 transpiler for Dart programs that statically check.

DDC attempts to map to idiomatic EcmaScript 6 (ES6) as cleanly as possible. To do this while cohering to Dart semantics, DDC relies heavily on static type information, static checking, and runtime assertions.

DDC is intended to support a very large subset of Dart. If a program does not statically check, DDC will not result in valid generated code. Our goal is that a program execution (of a valid program) that runs without triggering runtime assertions should run the same on other Dart platforms under checked mode or production mode.

DDC does support untyped Dart code, but it will typically result in less readable and less efficient ES6 output.

DDC has the following project goals:

  • Effective static checking and error detection.
  • A debugging solution for all modern browsers.
  • Readable output.
  • Fast, modular compilation of Dart code.
  • Easy use of generated code from JavaScript.

DDC is targeting the subset of ES6 supported in Chrome.

14 questions
5
votes
4 answers

Flutter web debug is working but build web shows a blank page

flutter doctor result [√] Flutter (Channel dev, 1.21.0-1.0.pre, on Microsoft Windows [Version 10.0.19041.388], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [√] Chrome - develop for the web [√]…
sidrao2006
  • 1,228
  • 2
  • 10
  • 32
4
votes
1 answer

Using Dart JS interop with ES6 classes

JavaSscript: class MyClass { constructor() { console.log("MyClass instance created"); this.answer = 42; } } let example = new MyClass(); console.log(example.answer); Dart: @JS() library interop_test; import…
András Szepesházi
  • 6,483
  • 5
  • 45
  • 59
3
votes
0 answers

Is there a way to turn off tree shaking when I build a flutter for web app with the "Flutter build web" command?

I am trying to put a prototype of my flutter app on the web so I can show it to some people but in release mode some features are broken while in debug mode they are not. I want to turn off tree-shaking to see if that might be causing the…
lost baby
  • 3,178
  • 4
  • 32
  • 53
3
votes
0 answers

Unable to find module for angular - bootstrap/modules.template.dart

I have a problem with transpiling Angular Dart application to javascript. I got following error messages: *Loading source assets... Loading dart_to_js_script_rewriter transformers... Building testapp... Building dartdevc modules... Unable to find…
Jakub
  • 31
  • 1
1
vote
1 answer

SASS not compiling with the Dart DDC

I am getting the following errors when compiling my web-app with DDC: SEVERE] build_web_compilers|ddc on package:sass/sass.dartdevc.module (cached): Error compiling dartdevc module:sass|lib/sass.ddc.js [error] Target of URI doesn't exist:…
Asperger
  • 3,064
  • 8
  • 52
  • 100
1
vote
0 answers

Mouse event for download working with dartdevc, but not dart2js

I am trying to use code modeled after https://stackoverflow.com/a/29702251/9885144 to do an HttpRequest, generate a download link from the returned blob, then automatically download it (all after clicking a button). Here is the function that runs…
1
vote
0 answers

How to cast HtmlWebSocketChannel to StreamChannel under strong mode?

I'm trying to connect to a json_rpc server in Chrome 62 on DDC 1.24.2 using the standard json_rpc_2 pub package. I'm following the Client based example found at: https://github.com/dart-lang/json_rpc_2#client. The example fails on the analysis phase…
1
vote
1 answer

same pubspec.yaml - build for both ddc and dart2js with debug

In current state of project I want to build both for ddc and dart2js with debug info. Is this possible with same pubspec.yaml? Using the recommended setting for ddc, the debug mode is associated with ddc. web: compiler: debug: dartdevc While…
Jonas Bojesen
  • 855
  • 1
  • 8
  • 22
1
vote
1 answer

Is Dart Dev Compiler supposed to support dart:io?

I tried compiling a simple HttpServer.bind with DDC and it seems to throw a runtime error saying "Operation not supported" on that line. Am I doing something wrong, or is DDC not supposed to support that?
Pacane
  • 20,273
  • 18
  • 60
  • 97
1
vote
2 answers

How can I interop with existing JS objects?

I'm trying to write Dart code that will generate a rough equivalent of this: var disposable = vscode['commands'].registerCommand( 'extension.sayHello', function () { vscode['window'].showInformationMessage('Hello World!'); …
Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
0
votes
1 answer

Dart Webdev Dev Compiler not running since upgrade to 2.3.2

Since I have moved from Dart 2.1.0 to 2.3.2 "webdev serve" runs successfully, but when I run the project, it gets a 404 on "main.digests". I updated my dev dependencies of build_runner, build_web_compiler, and webdev to the latest versions, and the…
AndrewL
  • 334
  • 2
  • 13
0
votes
1 answer

Is it possible to call Dart code generated with dartdevc from JavaScript?

I have a bunch of Dart libraries that a customer wants to call from JavaScript. Is it possible to call functions created with dartdevc from JS?
jfp
  • 381
  • 1
  • 3
  • 8
0
votes
1 answer

Compiling Dart into minifier friendly javascript: From dartdevc into google-closure-compiler

What compiler options are best to ensure that dartdevc generates minifier friendly javascript code which can be compressed by google closure compiler in ADVANCED mode. Please show a tested example that specifies options for 1. dartdevc, and 2. java…
0
votes
1 answer

How can I call a Dart library created with DDC from JavaScript?

I've created a large library in Dart that need to be called from JavaScript. I'd like to avoid using JS Interop if possible. Can I use the Dart Dev Compiler to do this? Is it possible to take the JavaScript code generated by DDC and easily call it…
jfp
  • 381
  • 1
  • 3
  • 8