[ci] Enable strict-casts (#3127)

* Enable strict-casts and fix violations

* Bump versions

* Fix Pigeon version bump
This commit is contained in:
stuartmorgan
2023-01-31 12:11:36 -08:00
committed by GitHub
parent f9037e4e29
commit ab6268907d
50 changed files with 157 additions and 132 deletions

View File

@ -7,7 +7,7 @@
analyzer:
language:
strict-casts: false # DIFFERENT FROM FLUTTER/FLUTTER, too many violations, TODO(goderbauer): Clean this up.
strict-casts: true
strict-raw-types: true
errors:
# allow self-reference to deprecated members (we do this because otherwise we have

View File

@ -1,5 +1,6 @@
## NEXT
## 0.3.3+3
* Updates code to fix strict-cast violations.
* Updates minimum SDK version to Flutter 3.0.
## 0.3.3+2

View File

@ -142,7 +142,7 @@ class XFile extends XFileBase {
rethrow;
}
_browserBlob = request.response;
_browserBlob = request.response as Blob?;
assert(_browserBlob != null, 'The Blob backing this XFile cannot be null!');

View File

@ -2,7 +2,7 @@ name: cross_file
description: An abstraction to allow working with files across multiple platforms.
repository: https://github.com/flutter/packages/tree/main/packages/cross_file
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+cross_file%22
version: 0.3.3+2
version: 0.3.3+3
environment:
sdk: ">=2.17.0 <3.0.0"

View File

@ -63,7 +63,7 @@ void main() {
test('Stores data as a Blob', () async {
// Read the blob from its path 'natively'
final Object response = await html.window.fetch(file.path);
final Object response = await html.window.fetch(file.path) as Object;
// Call '.arrayBuffer()' on the fetch response object to look at its bytes.
final ByteBuffer data = await js_util.promiseToFuture(
js_util.callMethod(response, 'arrayBuffer', <Object?>[]),

View File

@ -104,7 +104,7 @@ void main() {
Timer.run(onAttempt);
return fakeAsync.run((FakeAsync fakeAsync) {
return NetworkImageWithRetry.defaultFetchStrategy(uri, failure);
});
}) as Future<FetchInstructions>;
},
);
@ -126,7 +126,7 @@ void main() {
Timer.run(onAttempt);
return fakeAsync.run((FakeAsync fakeAsync) {
return NetworkImageWithRetry.defaultFetchStrategy(uri, failure);
});
}) as Future<FetchInstructions>;
},
);

View File

@ -43,11 +43,14 @@ MockHttpClient createMockImageHttpClient(SecurityContext? _) {
// Define an image stream that streams the mock test image for all
// image tests that request an image.
StreamSubscription<List<int>> imageStream(Invocation invocation) {
final void Function(List<int>)? onData = invocation.positionalArguments[0];
final void Function()? onDone = invocation.namedArguments[#onDone];
final void Function(List<int>)? onData =
invocation.positionalArguments[0] as Function(List<int>)?;
final void Function()? onDone =
invocation.namedArguments[#onDone] as Function()?;
final void Function(Object, [StackTrace?])? onError =
invocation.namedArguments[#onError];
final bool? cancelOnError = invocation.namedArguments[#cancelOnError];
invocation.namedArguments[#onError] as Function(Object, [StackTrace?])?;
final bool? cancelOnError =
invocation.namedArguments[#cancelOnError] as bool?;
return Stream<List<int>>.fromIterable(<List<int>>[transparentImage]).listen(
onData,
@ -345,16 +348,17 @@ class MockHttpClientResponse extends Mock implements HttpClientResponse {
StreamSubscription<List<int>> listen(void Function(List<int> event)? onData,
{Function? onError, void Function()? onDone, bool? cancelOnError}) =>
super.noSuchMethod(
Invocation.method(
#listen,
<Object?>[onData],
<Symbol, Object?>{
#onError: onError,
#onDone: onDone,
#cancelOnError: cancelOnError
},
),
returnValue: _FakeStreamSubscription<List<int>>());
Invocation.method(
#listen,
<Object?>[onData],
<Symbol, Object?>{
#onError: onError,
#onDone: onDone,
#cancelOnError: cancelOnError
},
),
returnValue: _FakeStreamSubscription<List<int>>())
as StreamSubscription<List<int>>;
@override
int get statusCode =>

View File

@ -1,3 +1,7 @@
## 0.0.1+1
* Updates code to fix strict-cast violations.
## 0.0.1
* Initial version.

View File

@ -46,7 +46,8 @@ class FlutterToolsEnvironment {
// minimally validate basic JSON format and trim away any accidental logging before.
if (commandOutput.contains(RegExp(r'[\s\S]*{[\s\S]+}[\s\S]*'))) {
commandOutput = commandOutput.substring(commandOutput.indexOf('{'));
mapping = jsonDecode(commandOutput.replaceAll(r'\', r'\\'));
mapping = jsonDecode(commandOutput.replaceAll(r'\', r'\\'))
as Map<String, Object?>;
}
return FlutterToolsEnvironment(mapping: mapping);
}

View File

@ -59,7 +59,7 @@ class MigrateUtils {
commandDescription: 'git ${cmdArgs.join(' ')}');
return DiffResult(
diffType: DiffType.command,
diff: result.stdout,
diff: result.stdout as String,
exitCode: result.exitCode);
}
@ -129,7 +129,7 @@ class MigrateUtils {
}
final ProcessResult result =
await _runCommand(cmdArgs, workingDirectory: outputDirectory);
final String error = result.stderr;
final String error = result.stderr as String;
// Catch errors due to parameters not existing.
@ -305,9 +305,9 @@ class MigrateUtils {
_logger.printError(commandDescription, indent: 2);
}
_logger.printError('Stdout:');
_logger.printError(result.stdout, indent: 2);
_logger.printError(result.stdout as String, indent: 2);
_logger.printError('Stderr:');
_logger.printError(result.stderr, indent: 2);
_logger.printError(result.stderr as String, indent: 2);
}
if (exit) {
throwToolExit(
@ -428,7 +428,7 @@ abstract class MergeResult {
class StringMergeResult extends MergeResult {
/// Initializes a BinaryMergeResult based off of a ProcessResult.
StringMergeResult(super.result, super.localPath)
: mergedString = result.stdout;
: mergedString = result.stdout as String;
/// Manually initializes a StringMergeResult with explicit values.
StringMergeResult.explicit({

View File

@ -1,6 +1,6 @@
name: flutter_migrate
description: A tool to migrate legacy flutter projects to modern versions.
version: 0.0.1
version: 0.0.1+1
repository: https://github.com/flutter/packages/tree/main/packages/flutter_migrate
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Ap%3A%20flutter_migrate
publish_to: none

View File

@ -92,8 +92,8 @@ Modified files:
'--verbose',
], workingDirectory: tempDir.path);
logger.printStatus('${result.exitCode}', color: TerminalColor.blue);
logger.printStatus(result.stdout, color: TerminalColor.green);
logger.printStatus(result.stderr, color: TerminalColor.red);
logger.printStatus(result.stdout as String, color: TerminalColor.green);
logger.printStatus(result.stderr as String, color: TerminalColor.red);
expect(result.exitCode, 0);
expect(result.stdout.toString(), contains('Migration complete'));
@ -151,8 +151,8 @@ class MyApp extends StatelessWidget {
'--verbose',
], workingDirectory: tempDir.path);
logger.printStatus('${result.exitCode}', color: TerminalColor.blue);
logger.printStatus(result.stdout, color: TerminalColor.green);
logger.printStatus(result.stderr, color: TerminalColor.red);
logger.printStatus(result.stdout as String, color: TerminalColor.green);
logger.printStatus(result.stderr as String, color: TerminalColor.red);
expect(result.exitCode, 0);
expect(result.stdout.toString(), contains('Migration complete'));

View File

@ -79,8 +79,8 @@ flutter:
''', flush: true);
await updatePubspecDependencies(flutterProject, utils, logger, terminal,
force: true);
final YamlMap pubspecYaml = loadYaml(pubspec.readAsStringSync());
final YamlMap dependenciesMap = pubspecYaml['dependencies'];
final YamlMap pubspecYaml = loadYaml(pubspec.readAsStringSync()) as YamlMap;
final YamlMap dependenciesMap = pubspecYaml['dependencies'] as YamlMap;
expect(
_VersionCode.fromString(dependenciesMap['characters'] as String) >
_VersionCode.fromString('1.2.0'),

View File

@ -1,5 +1,6 @@
## NEXT
## 1.0.7
* Updates code to fix strict-cast violations.
* Updates minimum SDK version to Flutter 3.0.
## 1.0.6

View File

@ -52,7 +52,7 @@ class GoogleBenchmarkParser {
)..removeWhere((String k, String v) => _kContextIgnoreKeys.contains(k));
final List<MetricPoint> points = <MetricPoint>[];
for (final dynamic item in jsonResult['benchmarks']) {
for (final dynamic item in jsonResult['benchmarks'] as List<dynamic>) {
_parseAnItem(item as Map<String, dynamic>, points, context);
}
return points;

View File

@ -1,5 +1,5 @@
name: metrics_center
version: 1.0.6
version: 1.0.7
description:
Support multiple performance metrics sources/formats and destinations.
repository: https://github.com/flutter/packages/tree/main/packages/metrics_center

View File

@ -1,3 +1,7 @@
## 7.1.5
* Updates code to fix strict-cast violations.
## 7.1.4
* [java] Fixes raw types lint issues.

View File

@ -11,7 +11,7 @@ import 'ast.dart';
/// The current version of pigeon.
///
/// This must match the version in pubspec.yaml.
const String pigeonVersion = '7.1.4';
const String pigeonVersion = '7.1.5';
/// Read all the content from [stdin] to a String.
String readStdin() {

View File

@ -1338,33 +1338,34 @@ ${_argParser.usage}''';
final ArgResults results = _argParser.parse(args);
final PigeonOptions opts = PigeonOptions(
input: results['input'],
dartOut: results['dart_out'],
dartTestOut: results['dart_test_out'],
objcHeaderOut: results['objc_header_out'],
objcSourceOut: results['objc_source_out'],
input: results['input'] as String?,
dartOut: results['dart_out'] as String?,
dartTestOut: results['dart_test_out'] as String?,
objcHeaderOut: results['objc_header_out'] as String?,
objcSourceOut: results['objc_source_out'] as String?,
objcOptions: ObjcOptions(
prefix: results['objc_prefix'],
prefix: results['objc_prefix'] as String?,
),
javaOut: results['java_out'],
javaOut: results['java_out'] as String?,
javaOptions: JavaOptions(
package: results['java_package'],
useGeneratedAnnotation: results['java_use_generated_annotation'],
package: results['java_package'] as String?,
useGeneratedAnnotation:
results['java_use_generated_annotation'] as bool?,
),
swiftOut: results['experimental_swift_out'],
kotlinOut: results['experimental_kotlin_out'],
swiftOut: results['experimental_swift_out'] as String?,
kotlinOut: results['experimental_kotlin_out'] as String?,
kotlinOptions: KotlinOptions(
package: results['experimental_kotlin_package'],
package: results['experimental_kotlin_package'] as String?,
),
cppHeaderOut: results['experimental_cpp_header_out'],
cppSourceOut: results['experimental_cpp_source_out'],
cppHeaderOut: results['experimental_cpp_header_out'] as String?,
cppSourceOut: results['experimental_cpp_source_out'] as String?,
cppOptions: CppOptions(
namespace: results['cpp_namespace'],
namespace: results['cpp_namespace'] as String?,
),
copyrightHeader: results['copyright_header'],
oneLanguage: results['one_language'],
astOut: results['ast_out'],
debugGenerators: results['debug_generators'],
copyrightHeader: results['copyright_header'] as String?,
oneLanguage: results['one_language'] as bool?,
astOut: results['ast_out'] as String?,
debugGenerators: results['debug_generators'] as bool?,
);
return opts;
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
// ignore_for_file: avoid_relative_lib_imports

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package com.example.alternate_language_test_plugin;

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#import <Foundation/Foundation.h>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#import "CoreTests.gen.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -17,7 +17,7 @@ void main() {
'dev.flutter.pigeon.MultipleArityHostApi.subtract', any))
.thenAnswer((Invocation realInvocation) async {
final Object input = MultipleArityHostApi.codec
.decodeMessage(realInvocation.positionalArguments[1])!;
.decodeMessage(realInvocation.positionalArguments[1] as ByteData?)!;
final List<Object?> args = input as List<Object?>;
final int x = (args[0] as int?)!;
final int y = (args[1] as int?)!;

View File

@ -12,8 +12,8 @@ void echoOneArgument(
) {
when(mockMessenger.send(channel, any))
.thenAnswer((Invocation realInvocation) async {
final Object input =
codec.decodeMessage(realInvocation.positionalArguments[1])!;
final Object input = codec
.decodeMessage(realInvocation.positionalArguments[1] as ByteData?)!;
final List<Object?> args = input as List<Object?>;
return codec.encodeMessage(<Object>[args[0]!]);
});

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

View File

@ -1,8 +1,8 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
//
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package com.example.test_plugin

View File

@ -1,8 +1,8 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
//
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
import Foundation
@ -117,23 +117,23 @@ struct AllNullableTypes {
var aNullableString: String? = nil
static func fromList(_ list: [Any?]) -> AllNullableTypes? {
let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?]
let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?]
var aNullableEnum: AnEnum? = nil
if let aNullableEnumRawValue = list[12] as? Int {
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
}
let aNullableString = list[13] as? String
let aNullableString = list[13] as? String
return AllNullableTypes(
aNullableBool: aNullableBool,

View File

@ -1,8 +1,8 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
//
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
import Foundation
@ -117,23 +117,23 @@ struct AllNullableTypes {
var aNullableString: String? = nil
static func fromList(_ list: [Any?]) -> AllNullableTypes? {
let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?]
let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?]
var aNullableEnum: AnEnum? = nil
if let aNullableEnumRawValue = list[12] as? Int {
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
}
let aNullableString = list[13] as? String
let aNullableString = list[13] as? String
return AllNullableTypes(
aNullableBool: aNullableBool,

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#undef _HAS_EXCEPTIONS

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Autogenerated from Pigeon (v7.1.4), do not edit directly.
// Autogenerated from Pigeon (v7.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#ifndef PIGEON_CORE_TESTS_GEN_H_

View File

@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
version: 7.1.4 # This must match the version in lib/generator_tools.dart
version: 7.1.5 # This must match the version in lib/generator_tools.dart
environment:
sdk: ">=2.12.0 <3.0.0"

View File

@ -48,7 +48,7 @@ usage: dart run tool/test.dart [-l | -t <test name>]
${parser.usage}''');
exit(0);
} else if (argResults.wasParsed(_testFlag)) {
testsToRun = argResults[_testFlag];
testsToRun = argResults[_testFlag] as List<String>;
}
// If no tests are provided, run everything that is supported on the current

View File

@ -1,3 +1,7 @@
## NEXT
* Updates code to fix strict-cast violations.
## 1.0.7
* Update README.

View File

@ -60,7 +60,7 @@ class _ExampleState extends State<Example> {
}
_runtime.update(const LibraryName(<String>['main']), decodeLibraryBlob(await interfaceFile.readAsBytes()));
_logic = WasmModule(await logicFile.readAsBytes()).builder().build();
_dataFetcher = _logic.lookupFunction('value');
_dataFetcher = _logic.lookupFunction('value') as WasmFunction;
_updateData();
setState(() { RendererBinding.instance.allowFirstFrame(); });
}
@ -87,7 +87,7 @@ class _ExampleState extends State<Example> {
data: _data,
widget: const FullyQualifiedWidgetName(LibraryName(<String>['main']), 'root'),
onEvent: (String name, DynamicMap arguments) {
final WasmFunction function = _logic.lookupFunction(name);
final WasmFunction function = _logic.lookupFunction(name) as WasmFunction;
function.apply(_asList(arguments['arguments']));
_updateData();
},

View File

@ -394,7 +394,7 @@ void main() {
await tester.pump();
expect(tester.widget<ColoredBox>(find.byType(ColoredBox)).color, const Color(0xFF000000));
data.update('color', json.decode('{"value":1}'));
data.update('color', json.decode('{"value":1}') as Object);
await tester.pump();
expect(tester.widget<ColoredBox>(find.byType(ColoredBox)).color, const Color(0x00000001));

View File

@ -1,3 +1,7 @@
## 0.1.0+2
* Updates code to fix strict-cast violations.
## 0.1.0+1
* Fixes lint warnings.

View File

@ -168,8 +168,8 @@ class Chrome {
'"Tracing.dataCollected" returned malformed data. '
'Expected a List but got: ${value.runtimeType}');
}
_tracingData
?.addAll(event.params!['value'].cast<Map<String, dynamic>>());
_tracingData?.addAll((event.params!['value'] as List<dynamic>)
.cast<Map<String, dynamic>>());
}
});
await _debugConnection?.sendCommand('Tracing.start', <String, dynamic>{
@ -233,7 +233,7 @@ String _findSystemChromeExecutable() {
throw Exception('Failed to locate system Chrome installation.');
}
final String output = which.stdout;
final String output = which.stdout as String;
return output.trim();
} else if (io.Platform.isMacOS) {
return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
@ -306,7 +306,7 @@ Future<Uri> _getRemoteDebuggerUrl(Uri base) async {
if (jsonObject == null || jsonObject.isEmpty) {
return base;
}
return base.resolve(jsonObject.first['webSocketDebuggerUrl']);
return base.resolve(jsonObject.first['webSocketDebuggerUrl'] as String);
}
/// Summarizes a Blink trace down to a few interesting values.
@ -613,7 +613,7 @@ class BlinkTraceEvent {
///
/// Returns null if the value is null.
int? _readInt(Map<String, dynamic> json, String key) {
final num? jsonValue = json[key];
final num? jsonValue = json[key] as num?;
if (jsonValue == null) {
return null; // ignore: avoid_returning_null

View File

@ -402,7 +402,7 @@ abstract class WidgetRecorder extends Recorder implements FrameRecorder {
@override
void _onError(dynamic error, StackTrace? stackTrace) {
_runCompleter.completeError(error, stackTrace);
_runCompleter.completeError(error as Object, stackTrace);
}
@override
@ -522,7 +522,7 @@ abstract class WidgetBuildRecorder extends Recorder implements FrameRecorder {
@override
void _onError(dynamic error, StackTrace? stackTrace) {
_runCompleter!.completeError(error, stackTrace);
_runCompleter!.completeError(error as Object, stackTrace);
}
@override

View File

@ -143,8 +143,8 @@ class BenchmarkServer {
chrome ??= await whenChromeIsReady;
if (request.requestedUri.path.endsWith('/profile-data')) {
final Map<String, dynamic> profile =
json.decode(await request.readAsString());
final String? benchmarkName = profile['name'];
json.decode(await request.readAsString()) as Map<String, dynamic>;
final String? benchmarkName = profile['name'] as String?;
if (benchmarkName != benchmarkIterator.current) {
profileData.completeError(Exception(
'Browser returned benchmark results from a wrong benchmark.\n'
@ -179,7 +179,7 @@ class BenchmarkServer {
return Response.ok('Stopped performance tracing');
} else if (request.requestedUri.path.endsWith('/on-error')) {
final Map<String, dynamic> errorDetails =
json.decode(await request.readAsString());
json.decode(await request.readAsString()) as Map<String, dynamic>;
server.close();
// Keep the stack trace as a string. It's thrown in the browser, not this Dart VM.
final String errorMessage =
@ -271,12 +271,13 @@ class BenchmarkServer {
final Map<String, List<BenchmarkScore>> results =
<String, List<BenchmarkScore>>{};
for (final Map<String, dynamic> profile in profiles) {
final String benchmarkName = profile['name'];
final String benchmarkName = profile['name'] as String;
if (benchmarkName.isEmpty) {
throw StateError('Benchmark name is empty');
}
final List<String> scoreKeys = List<String>.from(profile['scoreKeys']);
final List<String> scoreKeys =
List<String>.from(profile['scoreKeys'] as Iterable<dynamic>);
if (scoreKeys == null || scoreKeys.isEmpty) {
throw StateError('No score keys in benchmark "$benchmarkName"');
}
@ -295,7 +296,7 @@ class BenchmarkServer {
}
scores.add(BenchmarkScore(
metric: key,
value: profile[key],
value: profile[key] as num,
));
}
results[benchmarkName] = scores;

View File

@ -2,7 +2,7 @@ name: web_benchmarks
description: A benchmark harness for performance-testing Flutter apps in Chrome.
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
version: 0.1.0+1
version: 0.1.0+2
environment:
sdk: '>=2.17.0 <3.0.0'

View File

@ -23,7 +23,7 @@ final Map<String, dynamic> beginMainFrameJson_89plus = jsonDecode('''
"ts": 2338687258440,
"tts": 375499
}
''');
''') as Map<String, dynamic>;
/// To test isUpdateAllLifecyclePhases. (Sampled from Chrome 89+)
final Map<String, dynamic> updateLifecycleJson_89plus = jsonDecode('''
@ -39,7 +39,7 @@ final Map<String, dynamic> updateLifecycleJson_89plus = jsonDecode('''
"ts": 2338687265284,
"tts": 375900
}
''');
''') as Map<String, dynamic>;
/// To test isBeginMeasuredFrame. (Sampled from Chrome 89+)
final Map<String, dynamic> beginMeasuredFrameJson_89plus = jsonDecode('''
@ -54,7 +54,7 @@ final Map<String, dynamic> beginMeasuredFrameJson_89plus = jsonDecode('''
"tid": 1,
"ts": 2338687265932
}
''');
''') as Map<String, dynamic>;
/// To test isEndMeasuredFrame. (Sampled from Chrome 89+)
final Map<String, dynamic> endMeasuredFrameJson_89plus = jsonDecode('''
@ -69,7 +69,7 @@ final Map<String, dynamic> endMeasuredFrameJson_89plus = jsonDecode('''
"tid": 1,
"ts": 2338687440485
}
''');
''') as Map<String, dynamic>;
/// An unrelated data frame to test negative cases.
final Map<String, dynamic> unrelatedPhXJson = jsonDecode('''
@ -85,7 +85,7 @@ final Map<String, dynamic> unrelatedPhXJson = jsonDecode('''
"ts": 2338691143317,
"tts": 1685405
}
''');
''') as Map<String, dynamic>;
/// Another unrelated data frame to test negative cases.
final Map<String, dynamic> anotherUnrelatedJson = jsonDecode('''
@ -100,4 +100,4 @@ final Map<String, dynamic> anotherUnrelatedJson = jsonDecode('''
"tid": 1,
"ts": 2338692906482
}
''');
''') as Map<String, dynamic>;