in lib/sharing/editor_ui.dart [178:231]
Future<bool> handleRun() async {
ga.sendEvent('main', 'run');
runButton.disabled = true;
final compilationTimer = Stopwatch()..start();
final compileRequest = CompileRequest()..source = fullDartSource;
try {
if (shouldCompileDDC) {
final response = await dartServices
.compileDDC(compileRequest)
.timeout(longServiceCallTimeout);
_sendCompilationTiming(compilationTimer.elapsedMilliseconds);
clearOutput();
await executionService.execute(
context.htmlSource,
context.cssSource,
response.result,
modulesBaseUrl: response.modulesBaseUrl,
addRequireJs: true,
addFirebaseJs: shouldAddFirebaseJs,
// TODO(srawlins): Determine if we need to destroy the frame when
// changing channels.
destroyFrame: false,
);
} else {
final response = await dartServices
.compile(compileRequest)
.timeout(longServiceCallTimeout);
_sendCompilationTiming(compilationTimer.elapsedMilliseconds);
clearOutput();
await executionService.execute(
context.htmlSource,
context.cssSource,
response.result,
destroyFrame: false,
);
}
return true;
} catch (e) {
ga.sendException('${e.runtimeType}');
final message = e is ApiRequestError ? e.message : '$e';
showSnackbar('Error compiling to JavaScript');
clearOutput();
showOutput('Error compiling to JavaScript:\n$message', error: true);
return false;
} finally {
runButton.disabled = false;
}
}