diff --git a/dev/benchmarks/platform_channels_benchmarks/lib/main.dart b/dev/benchmarks/platform_channels_benchmarks/lib/main.dart index 530e53ab32..a44e719b17 100644 --- a/dev/benchmarks/platform_channels_benchmarks/lib/main.dart +++ b/dev/benchmarks/platform_channels_benchmarks/lib/main.dart @@ -12,8 +12,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:microbenchmarks/common.dart'; -List _makeTestBuffer(int size) { - final List answer = []; +List _makeTestBuffer(int size) { + final List answer = []; for (int i = 0; i < size; ++i) { switch (i % 9) { case 0: @@ -49,7 +49,7 @@ List _makeTestBuffer(int size) { } Future _runBasicStandardSmall( - BasicMessageChannel basicStandard, int count) async { + BasicMessageChannel basicStandard, int count) async { final Stopwatch watch = Stopwatch(); watch.start(); for (int i = 0; i < count; ++i) { @@ -59,14 +59,14 @@ Future _runBasicStandardSmall( return watch.elapsedMicroseconds / count; } -Future _runBasicStandardLarge(BasicMessageChannel basicStandard, - List largeBuffer, int count) async { +Future _runBasicStandardLarge(BasicMessageChannel basicStandard, + List largeBuffer, int count) async { int size = 0; final Stopwatch watch = Stopwatch(); watch.start(); for (int i = 0; i < count; ++i) { - final List result = - await basicStandard.send(largeBuffer) as List; + final List? result = + await basicStandard.send(largeBuffer) as List?; // This check should be tiny compared to the actual channel send/receive. size += (result == null) ? 0 : result.length; } @@ -87,7 +87,7 @@ Future _runBasicBinary(BasicMessageChannel basicBinary, final Stopwatch watch = Stopwatch(); watch.start(); for (int i = 0; i < count; ++i) { - final ByteData result = await basicBinary.send(buffer); + final ByteData? result = await basicBinary.send(buffer); // This check should be tiny compared to the actual channel send/receive. size += (result == null) ? 0 : result.lengthInBytes; } @@ -108,11 +108,11 @@ Future _runTests() async { ); } - const BasicMessageChannel resetChannel = BasicMessageChannel( + const BasicMessageChannel resetChannel = BasicMessageChannel( 'dev.flutter.echo.reset', StandardMessageCodec(), ); - const BasicMessageChannel basicStandard = BasicMessageChannel( + const BasicMessageChannel basicStandard = BasicMessageChannel( 'dev.flutter.echo.basic.standard', StandardMessageCodec(), ); @@ -125,9 +125,9 @@ Future _runTests() async { /// WARNING: Don't change the following line of code, it will invalidate /// `Large` tests. Instead make a different test. The size of largeBuffer /// serialized is 14214 bytes. - final List largeBuffer = _makeTestBuffer(1000); + final List largeBuffer = _makeTestBuffer(1000); final ByteData largeBufferBytes = - const StandardMessageCodec().encodeMessage(largeBuffer); + const StandardMessageCodec().encodeMessage(largeBuffer)!; final ByteData oneMB = ByteData(1024 * 1024); const int numMessages = 2500; @@ -170,7 +170,7 @@ Future _runTests() async { } class _BenchmarkWidget extends StatefulWidget { - const _BenchmarkWidget(this.tests, {Key key}) : super(key: key); + const _BenchmarkWidget(this.tests, {Key? key}) : super(key: key); final Future Function() tests; diff --git a/dev/benchmarks/platform_channels_benchmarks/pubspec.yaml b/dev/benchmarks/platform_channels_benchmarks/pubspec.yaml index fe4edd4669..b16a5a1dc1 100644 --- a/dev/benchmarks/platform_channels_benchmarks/pubspec.yaml +++ b/dev/benchmarks/platform_channels_benchmarks/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.9.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: