[flutter_tools] add support for enable null safety asserts (#61114)

Enable null safety asserts for web debug mode. This induces runtime asserts at the boundaries between null safe and non-null safe libraries. Adds integration test that validates assertion error is thrown.

#61042
This commit is contained in:
Jonah Williams
2020-07-15 09:54:39 -07:00
committed by GitHub
parent 0a64b5b271
commit cb7770b3a5
6 changed files with 53 additions and 1 deletions

View File

@@ -48,12 +48,18 @@ document.head.appendChild(requireEl);
/// the file `foo/bar/baz.dart` will generate a property named approximately
/// `foo__bar__baz`. Rather than attempt to guess, we assume the first property of
/// this object is the module.
String generateMainModule({@required String entrypoint}) {
String generateMainModule({
@required String entrypoint,
@required bool nullSafety,
}) {
return '''/* ENTRYPOINT_EXTENTION_MARKER */
// Create the main module loaded below.
define("main_module.bootstrap", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
dart_sdk.dart.setStartAsyncSynchronously(true);
dart_sdk._debugger.registerDevtoolsFormatter();
if ($nullSafety) {
dart_sdk.dart.nonNullAsserts(true);
}
// See the generateMainModule doc comment.
var child = {};