mirror of
https://github.com/encounter/flutter.git
synced 2026-03-30 11:10:35 -07:00
enable lint unnecessary_const (#19342)
This commit is contained in:
committed by
GitHub
parent
d10e46ea65
commit
cc1cf13eec
@@ -142,6 +142,7 @@ linter:
|
||||
- type_init_formals
|
||||
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_const
|
||||
- unnecessary_getters_setters
|
||||
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
|
||||
- unnecessary_null_aware_assignments
|
||||
|
||||
@@ -133,43 +133,43 @@ class TopBarMenu extends StatelessWidget {
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Friends',
|
||||
child: const MenuItemWithIcon(Icons.people, 'Friends', '5 new')
|
||||
child: MenuItemWithIcon(Icons.people, 'Friends', '5 new')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
|
||||
child: MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.group, 'Groups', '14')
|
||||
child: MenuItemWithIcon(Icons.group, 'Groups', '14')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.image, 'Pictures', '12')
|
||||
child: MenuItemWithIcon(Icons.image, 'Pictures', '12')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
|
||||
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Friends',
|
||||
child: const MenuItemWithIcon(Icons.people, 'Friends', '5')
|
||||
child: MenuItemWithIcon(Icons.people, 'Friends', '5')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.event, 'Events', '12')
|
||||
child: MenuItemWithIcon(Icons.event, 'Events', '12')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.group, 'Groups', '14')
|
||||
child: MenuItemWithIcon(Icons.group, 'Groups', '14')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.image, 'Pictures', '12')
|
||||
child: MenuItemWithIcon(Icons.image, 'Pictures', '12')
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'Events',
|
||||
child: const MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
|
||||
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
|
||||
)
|
||||
]
|
||||
);
|
||||
@@ -212,8 +212,8 @@ class FancyImageItem extends StatelessWidget {
|
||||
new ItemImageBox(),
|
||||
new InfoBar(),
|
||||
const Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: const Divider()
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Divider()
|
||||
),
|
||||
new IconBar(),
|
||||
new FatDivider()
|
||||
@@ -234,8 +234,8 @@ class FancyGalleryItem extends StatelessWidget {
|
||||
new ItemGalleryBox(index),
|
||||
new InfoBar(),
|
||||
const Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: const Divider()
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Divider()
|
||||
),
|
||||
new IconBar(),
|
||||
new FatDivider()
|
||||
@@ -268,9 +268,9 @@ class IconBar extends StatelessWidget {
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const <Widget>[
|
||||
const IconWithText(Icons.thumb_up, 'Like'),
|
||||
const IconWithText(Icons.comment, 'Comment'),
|
||||
const IconWithText(Icons.share, 'Share'),
|
||||
IconWithText(Icons.thumb_up, 'Like'),
|
||||
IconWithText(Icons.comment, 'Comment'),
|
||||
IconWithText(Icons.share, 'Share'),
|
||||
]
|
||||
)
|
||||
);
|
||||
@@ -350,9 +350,9 @@ class UserHeader extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: const Image(
|
||||
image: const AssetImage('packages/flutter_gallery_assets/people/square/ali.png'),
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: Image(
|
||||
image: AssetImage('packages/flutter_gallery_assets/people/square/ali.png'),
|
||||
width: 32.0,
|
||||
height: 32.0
|
||||
)
|
||||
@@ -367,7 +367,7 @@ class UserHeader extends StatelessWidget {
|
||||
children: <TextSpan>[
|
||||
new TextSpan(text: userName, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
const TextSpan(text: ' shared a new '),
|
||||
const TextSpan(text: 'photo', style: const TextStyle(fontWeight: FontWeight.bold))
|
||||
const TextSpan(text: 'photo', style: TextStyle(fontWeight: FontWeight.bold))
|
||||
]
|
||||
)),
|
||||
new Row(
|
||||
@@ -390,8 +390,8 @@ class ItemDescription extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: const Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -409,8 +409,8 @@ class ItemImageBox extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
const SizedBox(
|
||||
height: 230.0,
|
||||
child: const Image(
|
||||
image: const AssetImage('packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png')
|
||||
child: Image(
|
||||
image: AssetImage('packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png')
|
||||
)
|
||||
),
|
||||
new Theme(
|
||||
@@ -439,14 +439,14 @@ class ItemImageBox extends StatelessWidget {
|
||||
),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: const RichText(
|
||||
text: const TextSpan(
|
||||
style: const TextStyle(color: Colors.white),
|
||||
children: const <TextSpan>[
|
||||
const TextSpan(
|
||||
text: TextSpan(
|
||||
style: TextStyle(color: Colors.white),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: 'Photo by '
|
||||
),
|
||||
const TextSpan(
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
TextSpan(
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
text: 'Chris Godley'
|
||||
)
|
||||
]
|
||||
@@ -561,11 +561,11 @@ class BottomBar extends StatelessWidget {
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const <Widget>[
|
||||
const BottomBarButton(Icons.new_releases, 'News'),
|
||||
const BottomBarButton(Icons.people, 'Requests'),
|
||||
const BottomBarButton(Icons.chat, 'Messenger'),
|
||||
const BottomBarButton(Icons.bookmark, 'Bookmark'),
|
||||
const BottomBarButton(Icons.alarm, 'Alarm'),
|
||||
BottomBarButton(Icons.new_releases, 'News'),
|
||||
BottomBarButton(Icons.people, 'Requests'),
|
||||
BottomBarButton(Icons.chat, 'Messenger'),
|
||||
BottomBarButton(Icons.bookmark, 'Bookmark'),
|
||||
BottomBarButton(Icons.alarm, 'Alarm'),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -670,7 +670,7 @@ class FancyDrawerHeader extends StatelessWidget {
|
||||
height: 200.0,
|
||||
child: const SafeArea(
|
||||
bottom: false,
|
||||
child: const Placeholder(),
|
||||
child: Placeholder(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ import 'package:stocks/stock_data.dart' as stock_data;
|
||||
|
||||
import '../common.dart';
|
||||
|
||||
const Duration kBenchmarkTime = const Duration(seconds: 15);
|
||||
const Duration kBenchmarkTime = Duration(seconds: 15);
|
||||
|
||||
class BenchmarkingBinding extends LiveTestWidgetsFlutterBinding {
|
||||
BenchmarkingBinding(this.stopwatch);
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:stocks/stock_data.dart' as stock_data;
|
||||
|
||||
import '../common.dart';
|
||||
|
||||
const Duration kBenchmarkTime = const Duration(seconds: 15);
|
||||
const Duration kBenchmarkTime = Duration(seconds: 15);
|
||||
|
||||
Future<Null> main() async {
|
||||
assert(false); // don't run this in checked mode! Use --release.
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:stocks/stock_data.dart' as stock_data;
|
||||
|
||||
import '../common.dart';
|
||||
|
||||
const Duration kBenchmarkTime = const Duration(seconds: 15);
|
||||
const Duration kBenchmarkTime = Duration(seconds: 15);
|
||||
|
||||
Future<Null> main() async {
|
||||
stock_data.StockData.actuallyFetchData = false;
|
||||
|
||||
@@ -520,7 +520,7 @@ class ArchivePublisher {
|
||||
|
||||
jsonData = _addRelease(jsonData);
|
||||
|
||||
const JsonEncoder encoder = const JsonEncoder.withIndent(' ');
|
||||
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
||||
metadataFile.writeAsStringSync(encoder.convert(jsonData));
|
||||
await _cloudCopy(metadataFile.absolute.path, metadataGsPath);
|
||||
}
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ final String yellow = hasColor ? '\x1B[33m' : '';
|
||||
final String cyan = hasColor ? '\x1B[36m' : '';
|
||||
final String reset = hasColor ? '\x1B[0m' : '';
|
||||
|
||||
const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
|
||||
const Map<String, ShardRunner> _kShards = <String, ShardRunner>{
|
||||
'analyze': _analyzeRepo,
|
||||
'tests': _runTests,
|
||||
'coverage': _runCoverage,
|
||||
@@ -33,8 +33,8 @@ const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
|
||||
// 'build_and_deploy_gallery': handled by travis_script.sh
|
||||
};
|
||||
|
||||
const Duration _kLongTimeout = const Duration(minutes: 45);
|
||||
const Duration _kShortTimeout = const Duration(minutes: 5);
|
||||
const Duration _kLongTimeout = Duration(minutes: 45);
|
||||
const Duration _kShortTimeout = Duration(minutes: 5);
|
||||
|
||||
/// When you call this, you can pass additional arguments to pass custom
|
||||
/// arguments to flutter test. For example, you might want to call this
|
||||
|
||||
@@ -313,7 +313,7 @@ void main() {
|
||||
new DateTime.now().difference(DateTime.parse(releases[0]['release_date'])),
|
||||
lessThan(const Duration(minutes: 1)),
|
||||
);
|
||||
const JsonEncoder encoder = const JsonEncoder.withIndent(' ');
|
||||
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
||||
expect(contents, equals(encoder.convert(jsonData)));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'utils.dart';
|
||||
/// Maximum amount of time a single task is allowed to take to run.
|
||||
///
|
||||
/// If exceeded the task is considered to have failed.
|
||||
const Duration _kDefaultTaskTimeout = const Duration(minutes: 15);
|
||||
const Duration _kDefaultTaskTimeout = Duration(minutes: 15);
|
||||
|
||||
/// Represents a unit of work performed in the CI environment that can
|
||||
/// succeed, fail and be retried independently of others.
|
||||
@@ -103,7 +103,7 @@ class _TaskRunner {
|
||||
_keepAlivePort = new RawReceivePort();
|
||||
|
||||
// Timeout if nothing bothers to connect and ask us to run the task.
|
||||
const Duration taskStartTimeout = const Duration(seconds: 10);
|
||||
const Duration taskStartTimeout = Duration(seconds: 10);
|
||||
_startTaskTimeout = new Timer(taskStartTimeout, () {
|
||||
if (!_taskStarted) {
|
||||
logger.severe('Task did not start in $taskStartTimeout.');
|
||||
@@ -147,7 +147,7 @@ class TaskResult {
|
||||
TaskResult.success(this.data, {this.benchmarkScoreKeys = const <String>[]})
|
||||
: this.succeeded = true,
|
||||
this.message = 'success' {
|
||||
const JsonEncoder prettyJson = const JsonEncoder.withIndent(' ');
|
||||
const JsonEncoder prettyJson = JsonEncoder.withIndent(' ');
|
||||
if (benchmarkScoreKeys != null) {
|
||||
for (String key in benchmarkScoreKeys) {
|
||||
if (!data.containsKey(key)) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'utils.dart';
|
||||
|
||||
const String _kProvisioningConfigFileEnvironmentVariable = 'FLUTTER_DEVICELAB_XCODE_PROVISIONING_CONFIG';
|
||||
const String _kTestXcconfigFileName = 'TestConfig.xcconfig';
|
||||
const FileSystem _fs = const io.LocalFileSystem();
|
||||
const FileSystem _fs = io.LocalFileSystem();
|
||||
|
||||
/// Patches the given Xcode project adding provisioning certificates and team
|
||||
/// information required to build and run the project, if
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
/// Slightly longer than task timeout that gives the task runner a chance to
|
||||
/// clean-up before forcefully quitting it.
|
||||
const Duration taskTimeoutWithGracePeriod = const Duration(minutes: 26);
|
||||
const Duration taskTimeoutWithGracePeriod = Duration(minutes: 26);
|
||||
|
||||
/// Runs a task in a separate Dart VM and collects the result using the VM
|
||||
/// service protocol.
|
||||
@@ -111,7 +111,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
throw 'not ready yet';
|
||||
return isolate;
|
||||
} catch (error) {
|
||||
const Duration connectionTimeout = const Duration(seconds: 10);
|
||||
const Duration connectionTimeout = Duration(seconds: 10);
|
||||
if (new DateTime.now().difference(started) > connectionTimeout) {
|
||||
throw new TimeoutException(
|
||||
'Failed to connect to the task runner process',
|
||||
@@ -119,7 +119,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
);
|
||||
}
|
||||
print('VM service not ready yet: $error');
|
||||
const Duration pauseBetweenRetries = const Duration(milliseconds: 200);
|
||||
const Duration pauseBetweenRetries = Duration(milliseconds: 200);
|
||||
print('Will retry in $pauseBetweenRetries.');
|
||||
await new Future<Null>.delayed(pauseBetweenRetries);
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ void setLocalEngineOptionIfNecessary(List<String> options, [String flavor]) {
|
||||
// If engine flavor was not specified explicitly then scan options looking
|
||||
// for flags that specify the engine flavor (--release, --profile or
|
||||
// --debug). Default flavor to debug if no flags were found.
|
||||
const Map<String, String> optionToFlavor = const <String, String>{
|
||||
const Map<String, String> optionToFlavor = <String, String>{
|
||||
'--release': 'release',
|
||||
'--debug': 'debug',
|
||||
'--profile': 'profile',
|
||||
@@ -557,7 +557,7 @@ void setLocalEngineOptionIfNecessary(List<String> options, [String flavor]) {
|
||||
flavor ??= 'debug';
|
||||
}
|
||||
|
||||
const Map<DeviceOperatingSystem, String> osNames = const <DeviceOperatingSystem, String>{
|
||||
const Map<DeviceOperatingSystem, String> osNames = <DeviceOperatingSystem, String>{
|
||||
DeviceOperatingSystem.ios: 'ios',
|
||||
DeviceOperatingSystem.android: 'android',
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ Future<TaskResult> runEndToEndTests() async {
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
|
||||
await prepareProvisioningCertificates(testDirectory.path);
|
||||
|
||||
const List<String> entryPoints = const <String>[
|
||||
const List<String> entryPoints = <String>[
|
||||
'lib/keyboard_resize.dart',
|
||||
'lib/driver.dart',
|
||||
'lib/screenshot.dart',
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'package:flutter_devicelab/framework/ios.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
/// The maximum amount of time a single microbenchmark is allowed to take.
|
||||
const Duration _kBenchmarkTimeout = const Duration(minutes: 10);
|
||||
const Duration _kBenchmarkTimeout = Duration(minutes: 10);
|
||||
|
||||
/// Creates a device lab task that runs benchmarks in
|
||||
/// `dev/benchmarks/microbenchmarks` reports results to the dashboard.
|
||||
|
||||
@@ -113,7 +113,7 @@ TaskFunction createBasicMaterialCompileTest() {
|
||||
|
||||
/// Measure application startup performance.
|
||||
class StartupTest {
|
||||
static const Duration _startupTimeout = const Duration(minutes: 5);
|
||||
static const Duration _startupTimeout = Duration(minutes: 5);
|
||||
|
||||
const StartupTest(this.testDirectory, { this.reportMetrics = true });
|
||||
|
||||
@@ -350,7 +350,7 @@ class CompileTest {
|
||||
};
|
||||
}
|
||||
|
||||
static const Map<String, String> _kSdkNameToMetricNameMapping = const <String, String> {
|
||||
static const Map<String, String> _kSdkNameToMetricNameMapping = <String, String> {
|
||||
'VMIsolate': 'aot_snapshot_size_vmisolate',
|
||||
'Isolate': 'aot_snapshot_size_isolate',
|
||||
'ReadOnlyData': 'aot_snapshot_size_rodata',
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:process/process.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
const ProcessManager processManager = const LocalProcessManager();
|
||||
const ProcessManager processManager = LocalProcessManager();
|
||||
|
||||
group('run.dart script', () {
|
||||
Future<ProcessResult> runScript(List<String> testNames) async {
|
||||
|
||||
@@ -43,36 +43,36 @@ class ExtendedStandardMessageCodec extends StandardMessageCodec {
|
||||
|
||||
Future<TestStepResult> basicBinaryHandshake(ByteData message) async {
|
||||
const BasicMessageChannel<ByteData> channel =
|
||||
const BasicMessageChannel<ByteData>(
|
||||
BasicMessageChannel<ByteData>(
|
||||
'binary-msg',
|
||||
const BinaryCodec(),
|
||||
BinaryCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<ByteData>(
|
||||
'Binary >${toString(message)}<', channel, message);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStringHandshake(String message) async {
|
||||
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
|
||||
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
|
||||
'string-msg',
|
||||
const StringCodec(),
|
||||
StringCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<String>('String >$message<', channel, message);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicJsonHandshake(dynamic message) async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'json-msg',
|
||||
const JSONMessageCodec(),
|
||||
JSONMessageCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<dynamic>('JSON >$message<', channel, message);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStandardHandshake(dynamic message) async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'std-msg',
|
||||
const ExtendedStandardMessageCodec(),
|
||||
ExtendedStandardMessageCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<dynamic>(
|
||||
'Standard >${toString(message)}<', channel, message);
|
||||
@@ -80,35 +80,35 @@ Future<TestStepResult> basicStandardHandshake(dynamic message) async {
|
||||
|
||||
Future<TestStepResult> basicBinaryMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<ByteData> channel =
|
||||
const BasicMessageChannel<ByteData>(
|
||||
BasicMessageChannel<ByteData>(
|
||||
'binary-unknown',
|
||||
const BinaryCodec(),
|
||||
BinaryCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<ByteData>('Binary', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStringMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
|
||||
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
|
||||
'string-unknown',
|
||||
const StringCodec(),
|
||||
StringCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<String>('String', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicJsonMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'json-unknown',
|
||||
const JSONMessageCodec(),
|
||||
JSONMessageCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<dynamic>('JSON', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStandardMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'std-unknown',
|
||||
const ExtendedStandardMessageCodec(),
|
||||
ExtendedStandardMessageCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<dynamic>('Standard', channel);
|
||||
}
|
||||
|
||||
@@ -9,46 +9,46 @@ import 'test_step.dart';
|
||||
|
||||
Future<TestStepResult> methodCallJsonSuccessHandshake(dynamic payload) async {
|
||||
const MethodChannel channel =
|
||||
const MethodChannel('json-method', const JSONMethodCodec());
|
||||
MethodChannel('json-method', JSONMethodCodec());
|
||||
return _methodCallSuccessHandshake(
|
||||
'JSON success($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallJsonErrorHandshake(dynamic payload) async {
|
||||
const MethodChannel channel =
|
||||
const MethodChannel('json-method', const JSONMethodCodec());
|
||||
MethodChannel('json-method', JSONMethodCodec());
|
||||
return _methodCallErrorHandshake('JSON error($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallJsonNotImplementedHandshake() async {
|
||||
const MethodChannel channel =
|
||||
const MethodChannel('json-method', const JSONMethodCodec());
|
||||
MethodChannel('json-method', JSONMethodCodec());
|
||||
return _methodCallNotImplementedHandshake('JSON notImplemented()', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallStandardSuccessHandshake(
|
||||
dynamic payload) async {
|
||||
const MethodChannel channel = const MethodChannel(
|
||||
const MethodChannel channel = MethodChannel(
|
||||
'std-method',
|
||||
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
|
||||
StandardMethodCodec(ExtendedStandardMessageCodec()),
|
||||
);
|
||||
return _methodCallSuccessHandshake(
|
||||
'Standard success($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallStandardErrorHandshake(dynamic payload) async {
|
||||
const MethodChannel channel = const MethodChannel(
|
||||
const MethodChannel channel = MethodChannel(
|
||||
'std-method',
|
||||
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
|
||||
StandardMethodCodec(ExtendedStandardMessageCodec()),
|
||||
);
|
||||
return _methodCallErrorHandshake(
|
||||
'Standard error($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallStandardNotImplementedHandshake() async {
|
||||
const MethodChannel channel = const MethodChannel(
|
||||
const MethodChannel channel = MethodChannel(
|
||||
'std-method',
|
||||
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
|
||||
StandardMethodCodec(ExtendedStandardMessageCodec()),
|
||||
);
|
||||
return _methodCallNotImplementedHandshake(
|
||||
'Standard notImplemented()', channel);
|
||||
|
||||
@@ -25,8 +25,8 @@ const String nothing = '-';
|
||||
/// - The Flutter app records the incoming reply echo.
|
||||
/// - The platform finally replies to the original message with another echo.
|
||||
class TestStepResult {
|
||||
static const TextStyle bold = const TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = const TestStepResult(
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user