Flutter 1.24 (#619)

diff --git a/Dockerfile b/Dockerfile
index 115bcff..4ee5e79 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,7 +6,7 @@
 # To retrieve this value, please run the following in your closest shell:
 #
 # $ (cd flutter && git rev-parse HEAD)
-ARG FLUTTER_COMMIT=198df796aa80073ef22bdf249e614e2ff33c6895
+ARG FLUTTER_COMMIT=022b333a089afb81c471ec43d1f1f4f26305d876
 
 # We install unzip and remove the apt-index again to keep the
 # docker image diff small.
diff --git a/cloud_run.Dockerfile b/cloud_run.Dockerfile
index 17877fa..168cd62 100644
--- a/cloud_run.Dockerfile
+++ b/cloud_run.Dockerfile
@@ -6,7 +6,7 @@
 # To retrieve this value, please run the following in your closest shell:
 #
 # $ (cd flutter && git rev-parse HEAD)
-ARG FLUTTER_COMMIT=198df796aa80073ef22bdf249e614e2ff33c6895
+ARG FLUTTER_COMMIT=022b333a089afb81c471ec43d1f1f4f26305d876
 
 # We install unzip and remove the apt-index again to keep the
 # docker image diff small.
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 04607c3..957383a 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -49,14 +49,14 @@
       name: build
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.5.0"
+    version: "1.5.1"
   build_config:
     dependency: transitive
     description:
       name: build_config
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.4.2"
+    version: "0.4.3"
   build_daemon:
     dependency: transitive
     description:
@@ -84,14 +84,14 @@
       name: build_runner
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.10.4"
+    version: "1.10.6"
   build_runner_core:
     dependency: transitive
     description:
       name: build_runner_core
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "6.0.3"
+    version: "6.1.1"
   build_web_compilers:
     dependency: "direct dev"
     description:
@@ -259,7 +259,7 @@
       name: meta
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.2.3"
+    version: "1.2.4"
   mime:
     dependency: transitive
     description:
diff --git a/flutter b/flutter
index 198df79..022b333 160000
--- a/flutter
+++ b/flutter
@@ -1 +1 @@
-Subproject commit 198df796aa80073ef22bdf249e614e2ff33c6895
+Subproject commit 022b333a089afb81c471ec43d1f1f4f26305d876
diff --git a/lib/src/common.dart b/lib/src/common.dart
index 27e0be8..a5fd1a1 100644
--- a/lib/src/common.dart
+++ b/lib/src/common.dart
@@ -38,7 +38,7 @@
 
 void main() {
   print("hello");
-  querySelector('#foo').text = 'bar';
+  querySelector('#foo')?.text = 'bar';
 }
 """;
 
@@ -83,7 +83,7 @@
 
 main() async {
   print("hello");
-  querySelector('#foo').text = 'bar';
+  querySelector('#foo')?.text = 'bar';
   var foo = await HttpRequest.getString('http://www.google.com');
   print(foo);
 }
diff --git a/lib/src/flutter_web.dart b/lib/src/flutter_web.dart
index 8458400..10dabd0 100644
--- a/lib/src/flutter_web.dart
+++ b/lib/src/flutter_web.dart
@@ -171,8 +171,11 @@
   static const String _samplePackageName = 'dartpad_sample';
 
   static String createPubspec(bool includeFlutterWeb) {
+    // Mark the samples as not null safe.
     var content = '''
 name: $_samplePackageName
+environment:
+  sdk: '>=2.10.0 <3.0.0'
 ''';
 
     if (includeFlutterWeb) {
diff --git a/pubspec.lock b/pubspec.lock
index abf165c..c6b5b39 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -357,7 +357,7 @@
       name: meta
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.2.3"
+    version: "1.2.4"
   mime:
     dependency: transitive
     description:
diff --git a/test/compiler_test.dart b/test/compiler_test.dart
index 2f92115..ae09202 100644
--- a/test/compiler_test.dart
+++ b/test/compiler_test.dart
@@ -27,137 +27,105 @@
       await compiler.dispose();
     });
 
-    test('simple', () {
-      return compiler.compile(sampleCode).then((CompilationResults result) {
-        print(result.problems);
+    test('simple', () async {
+      final result = await compiler.compile(sampleCode);
+      print(result.problems);
 
-        expect(result.success, true);
-        expect(result.compiledJS, isNotEmpty);
-        expect(result.sourceMap, isNull);
-      });
+      expect(result.success, true);
+      expect(result.compiledJS, isNotEmpty);
+      expect(result.sourceMap, isNull);
     });
 
-    test('compileDDC simple', () {
-      return compiler
-          .compileDDC(sampleCode)
-          .then((DDCCompilationResults result) {
-        expect(result.success, true);
-        expect(result.compiledJS, isNotEmpty);
-        expect(result.modulesBaseUrl, isNotEmpty);
+    test('compileDDC simple', () async {
+      final result = await compiler.compileDDC(sampleCode);
+      expect(result.success, true);
+      expect(result.compiledJS, isNotEmpty);
+      expect(result.modulesBaseUrl, isNotEmpty);
 
-        expect(result.compiledJS, contains("define('dartpad_main', ["));
-      });
+      expect(result.compiledJS, contains("define('dartpad_main', ["));
     });
 
-    test('compileDDC with web', () {
-      return compiler
-          .compileDDC(sampleCodeWeb)
-          .then((DDCCompilationResults result) {
-        expect(result.success, true);
-        expect(result.compiledJS, isNotEmpty);
-        expect(result.modulesBaseUrl, isNotEmpty);
+    test('compileDDC with web', () async {
+      final result = await compiler.compileDDC(sampleCodeWeb);
+      expect(result.success, true);
+      expect(result.compiledJS, isNotEmpty);
+      expect(result.modulesBaseUrl, isNotEmpty);
 
-        expect(result.compiledJS, contains("define('dartpad_main', ["));
-      });
+      expect(result.compiledJS, contains("define('dartpad_main', ["));
     });
 
-    test('compileDDC with Flutter', () {
-      return compiler
-          .compileDDC(sampleCodeFlutter)
-          .then((DDCCompilationResults result) {
-        print(result.problems);
+    test('compileDDC with Flutter', () async {
+      final result = await compiler.compileDDC(sampleCodeFlutter);
+      print(result.problems);
 
-        expect(result.success, true);
-        expect(result.compiledJS, isNotEmpty);
-        expect(result.modulesBaseUrl, isNotEmpty);
+      expect(result.success, true);
+      expect(result.compiledJS, isNotEmpty);
+      expect(result.modulesBaseUrl, isNotEmpty);
 
-        expect(result.compiledJS, contains("define('dartpad_main', ["));
-      });
+      expect(result.compiledJS, contains("define('dartpad_main', ["));
     });
 
-    test('compileDDC with async', () {
-      return compiler
-          .compileDDC(sampleCodeAsync)
-          .then((DDCCompilationResults result) {
-        expect(result.success, true);
-        expect(result.compiledJS, isNotEmpty);
-        expect(result.modulesBaseUrl, isNotEmpty);
+    test('compileDDC with async', () async {
+      final result = await compiler.compileDDC(sampleCodeAsync);
+      expect(result.success, true);
+      expect(result.compiledJS, isNotEmpty);
+      expect(result.modulesBaseUrl, isNotEmpty);
 
-        expect(result.compiledJS, contains("define('dartpad_main', ["));
-      });
+      expect(result.compiledJS, contains("define('dartpad_main', ["));
     });
 
-    test('compileDDC with single error', () {
-      return compiler
-          .compileDDC(sampleCodeError)
-          .then((DDCCompilationResults result) {
-        expect(result.success, false);
-        expect(result.problems.length, 1);
-        expect(result.problems[0].toString(),
-            contains('Error: Expected \';\' after this.'));
-      });
+    test('compileDDC with single error', () async {
+      final result = await compiler.compileDDC(sampleCodeError);
+      expect(result.success, false);
+      expect(result.problems.length, 1);
+      expect(result.problems[0].toString(),
+          contains('Error: Expected \';\' after this.'));
     });
 
-    test('compileDDC with multiple errors', () {
-      return compiler
-          .compileDDC(sampleCodeErrors)
-          .then((DDCCompilationResults result) {
-        expect(result.success, false);
-        expect(result.problems.length, 1);
-        expect(result.problems[0].toString(),
-            contains('Error: Method not found: \'print1\'.'));
-        expect(result.problems[0].toString(),
-            contains('Error: Method not found: \'print2\'.'));
-        expect(result.problems[0].toString(),
-            contains('Error: Method not found: \'print3\'.'));
-      });
+    test('compileDDC with multiple errors', () async {
+      final result = await compiler.compileDDC(sampleCodeErrors);
+      expect(result.success, false);
+      expect(result.problems.length, 1);
+      expect(result.problems[0].toString(),
+          contains('Error: Method not found: \'print1\'.'));
+      expect(result.problems[0].toString(),
+          contains('Error: Method not found: \'print2\'.'));
+      expect(result.problems[0].toString(),
+          contains('Error: Method not found: \'print3\'.'));
     });
 
-    test('sourcemap', () {
-      return compiler
-          .compile(sampleCode, returnSourceMap: true)
-          .then((CompilationResults result) {
-        expect(result.success, true);
-        expect(result.compiledJS, isNotEmpty);
-        expect(result.sourceMap, isNotNull);
-        expect(result.sourceMap, isNotEmpty);
-      });
+    test('sourcemap', () async {
+      final result = await compiler.compile(sampleCode, returnSourceMap: true);
+      expect(result.success, true);
+      expect(result.compiledJS, isNotEmpty);
+      expect(result.sourceMap, isNotNull);
+      expect(result.sourceMap, isNotEmpty);
     });
 
-    test('version', () {
-      return compiler
-          .compile(sampleCode, returnSourceMap: true)
-          .then((CompilationResults result) {
-        expect(result.sourceMap, isNotNull);
-        expect(result.sourceMap, isNotEmpty);
-      });
+    test('version', () async {
+      final result = await compiler.compile(sampleCode, returnSourceMap: true);
+      expect(result.sourceMap, isNotNull);
+      expect(result.sourceMap, isNotEmpty);
     });
 
-    test('simple web', () {
-      return compiler.compile(sampleCodeWeb).then((CompilationResults result) {
-        expect(result.success, true);
-      });
+    test('simple web', () async {
+      final result = await compiler.compile(sampleCodeWeb);
+      expect(result.success, true);
     });
 
-    test('web async', () {
-      return compiler
-          .compile(sampleCodeAsync)
-          .then((CompilationResults result) {
-        expect(result.success, true);
-      });
+    test('web async', () async {
+      final result = await compiler.compile(sampleCodeAsync);
+      expect(result.success, true);
     });
 
-    test('errors', () {
-      return compiler
-          .compile(sampleCodeError)
-          .then((CompilationResults result) {
-        expect(result.success, false);
-        expect(result.problems.length, 1);
-        expect(result.problems[0].toString(), contains('Error: Expected'));
-      });
+    test('errors', () async {
+      final result = await compiler.compile(sampleCodeError);
+      expect(result.success, false);
+      expect(result.problems.length, 1);
+      expect(result.problems[0].toString(), contains('Error: Expected'));
     });
 
-    test('good import', () {
+    test('good import', () async {
       const code = '''
 import 'dart:html';
 
@@ -167,31 +135,28 @@
 }
 
 ''';
-      return compiler.compile(code).then((CompilationResults result) {
-        expect(result.problems.length, 0);
-      });
+      final result = await compiler.compile(code);
+      expect(result.problems.length, 0);
     });
 
-    test('bad import - local', () {
+    test('bad import - local', () async {
       const code = '''
 import 'foo.dart';
 void main() { missingMethod ('foo'); }
 ''';
-      return compiler.compile(code).then((CompilationResults result) {
-        expect(result.problems.first.message,
-            equals('unsupported import: foo.dart'));
-      });
+      final result = await compiler.compile(code);
+      expect(result.problems.first.message,
+          equals('unsupported import: foo.dart'));
     });
 
-    test('bad import - http', () {
+    test('bad import - http', () async {
       const code = '''
 import 'http://example.com';
 void main() { missingMethod ('foo'); }
 ''';
-      return compiler.compile(code).then((CompilationResults result) {
-        expect(result.problems.first.message,
-            equals('unsupported import: http://example.com'));
-      });
+      final result = await compiler.compile(code);
+      expect(result.problems.first.message,
+          equals('unsupported import: http://example.com'));
     });
 
     test('disallow compiler warnings', () async {
@@ -199,22 +164,18 @@
       expect(result.success, false);
     });
 
-    test('transitive errors', () {
+    test('transitive errors', () async {
       const code = '''
 import 'dart:foo';
 void main() { print ('foo'); }
 ''';
-      return compiler.compile(code).then((CompilationResults result) {
-        expect(result.problems.length, 1);
-      });
+      final result = await compiler.compile(code);
+      expect(result.problems.length, 1);
     });
 
-    test('errors for dart 2', () {
-      return compiler
-          .compile(sampleDart2Error)
-          .then((CompilationResults result) {
-        expect(result.problems.length, 1);
-      });
+    test('errors for dart 2', () async {
+      final result = await compiler.compile(sampleDart2Error);
+      expect(result.problems.length, 1);
     });
   });
 }