Unverified Commit 42fa4f03 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Migrate some more non-test utils for tests (#67351)

parent 8998167d
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
class Dessert { class Dessert {
Dessert(this.name, this.calories, this.fat, this.carbs, this.protein, this.sodium, this.calcium, this.iron); Dessert(this.name, this.calories, this.fat, this.carbs, this.protein, this.sodium, this.calcium, this.iron);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
/// Tracks how often feedback has been requested since its instantiation. /// Tracks how often feedback has been requested since its instantiation.
......
...@@ -10,7 +10,6 @@ import 'package:flutter/painting.dart'; ...@@ -10,7 +10,6 @@ import 'package:flutter/painting.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
class TestImageProvider extends ImageProvider<TestImageProvider> { class TestImageProvider extends ImageProvider<TestImageProvider> {
TestImageProvider(this.testImage); TestImageProvider(this.testImage);
......
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../flutter_test_alternative.dart'; import '../flutter_test_alternative.dart';
void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes) { void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes) {
final ByteData encoded = codec.encodeMessage(message); final ByteData encoded = codec.encodeMessage(message)!;
expect( expect(
encoded.buffer.asUint8List(0, encoded.lengthInBytes), encoded.buffer.asUint8List(0, encoded.lengthInBytes),
orderedEquals(expectedBytes), orderedEquals(expectedBytes),
...@@ -18,17 +16,17 @@ void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes) ...@@ -18,17 +16,17 @@ void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes)
} }
void checkEncodeDecode<T>(MessageCodec<T> codec, T message) { void checkEncodeDecode<T>(MessageCodec<T> codec, T message) {
final ByteData encoded = codec.encodeMessage(message); final ByteData? encoded = codec.encodeMessage(message);
final T decoded = codec.decodeMessage(encoded); final T decoded = codec.decodeMessage(encoded);
if (message == null) { if (message == null) {
expect(encoded, isNull); expect(encoded, isNull);
expect(decoded, isNull); expect(decoded, isNull);
} else { } else {
expect(deepEquals(message, decoded), isTrue); expect(deepEquals(message, decoded), isTrue);
final ByteData encodedAgain = codec.encodeMessage(decoded); final ByteData encodedAgain = codec.encodeMessage(decoded)!;
expect( expect(
encodedAgain.buffer.asUint8List(), encodedAgain.buffer.asUint8List(),
orderedEquals(encoded.buffer.asUint8List()), orderedEquals(encoded!.buffer.asUint8List()),
); );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment