[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: analyzer:
language: language:
strict-casts: false # DIFFERENT FROM FLUTTER/FLUTTER, too many violations, TODO(goderbauer): Clean this up. strict-casts: true
strict-raw-types: true strict-raw-types: true
errors: errors:
# allow self-reference to deprecated members (we do this because otherwise we have # 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. * Updates minimum SDK version to Flutter 3.0.
## 0.3.3+2 ## 0.3.3+2

View File

@ -142,7 +142,7 @@ class XFile extends XFileBase {
rethrow; rethrow;
} }
_browserBlob = request.response; _browserBlob = request.response as Blob?;
assert(_browserBlob != null, 'The Blob backing this XFile cannot be null!'); 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. description: An abstraction to allow working with files across multiple platforms.
repository: https://github.com/flutter/packages/tree/main/packages/cross_file 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 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: environment:
sdk: ">=2.17.0 <3.0.0" sdk: ">=2.17.0 <3.0.0"

View File

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

View File

@ -104,7 +104,7 @@ void main() {
Timer.run(onAttempt); Timer.run(onAttempt);
return fakeAsync.run((FakeAsync fakeAsync) { return fakeAsync.run((FakeAsync fakeAsync) {
return NetworkImageWithRetry.defaultFetchStrategy(uri, failure); return NetworkImageWithRetry.defaultFetchStrategy(uri, failure);
}); }) as Future<FetchInstructions>;
}, },
); );
@ -126,7 +126,7 @@ void main() {
Timer.run(onAttempt); Timer.run(onAttempt);
return fakeAsync.run((FakeAsync fakeAsync) { return fakeAsync.run((FakeAsync fakeAsync) {
return NetworkImageWithRetry.defaultFetchStrategy(uri, failure); 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 // Define an image stream that streams the mock test image for all
// image tests that request an image. // image tests that request an image.
StreamSubscription<List<int>> imageStream(Invocation invocation) { StreamSubscription<List<int>> imageStream(Invocation invocation) {
final void Function(List<int>)? onData = invocation.positionalArguments[0]; final void Function(List<int>)? onData =
final void Function()? onDone = invocation.namedArguments[#onDone]; invocation.positionalArguments[0] as Function(List<int>)?;
final void Function()? onDone =
invocation.namedArguments[#onDone] as Function()?;
final void Function(Object, [StackTrace?])? onError = final void Function(Object, [StackTrace?])? onError =
invocation.namedArguments[#onError]; invocation.namedArguments[#onError] as Function(Object, [StackTrace?])?;
final bool? cancelOnError = invocation.namedArguments[#cancelOnError]; final bool? cancelOnError =
invocation.namedArguments[#cancelOnError] as bool?;
return Stream<List<int>>.fromIterable(<List<int>>[transparentImage]).listen( return Stream<List<int>>.fromIterable(<List<int>>[transparentImage]).listen(
onData, onData,
@ -345,16 +348,17 @@ class MockHttpClientResponse extends Mock implements HttpClientResponse {
StreamSubscription<List<int>> listen(void Function(List<int> event)? onData, StreamSubscription<List<int>> listen(void Function(List<int> event)? onData,
{Function? onError, void Function()? onDone, bool? cancelOnError}) => {Function? onError, void Function()? onDone, bool? cancelOnError}) =>
super.noSuchMethod( super.noSuchMethod(
Invocation.method( Invocation.method(
#listen, #listen,
<Object?>[onData], <Object?>[onData],
<Symbol, Object?>{ <Symbol, Object?>{
#onError: onError, #onError: onError,
#onDone: onDone, #onDone: onDone,
#cancelOnError: cancelOnError #cancelOnError: cancelOnError
}, },
), ),
returnValue: _FakeStreamSubscription<List<int>>()); returnValue: _FakeStreamSubscription<List<int>>())
as StreamSubscription<List<int>>;
@override @override
int get statusCode => int get statusCode =>

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
name: flutter_migrate name: flutter_migrate
description: A tool to migrate legacy flutter projects to modern versions. 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 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 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Ap%3A%20flutter_migrate
publish_to: none publish_to: none

View File

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

View File

@ -79,8 +79,8 @@ flutter:
''', flush: true); ''', flush: true);
await updatePubspecDependencies(flutterProject, utils, logger, terminal, await updatePubspecDependencies(flutterProject, utils, logger, terminal,
force: true); force: true);
final YamlMap pubspecYaml = loadYaml(pubspec.readAsStringSync()); final YamlMap pubspecYaml = loadYaml(pubspec.readAsStringSync()) as YamlMap;
final YamlMap dependenciesMap = pubspecYaml['dependencies']; final YamlMap dependenciesMap = pubspecYaml['dependencies'] as YamlMap;
expect( expect(
_VersionCode.fromString(dependenciesMap['characters'] as String) > _VersionCode.fromString(dependenciesMap['characters'] as String) >
_VersionCode.fromString('1.2.0'), _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. * Updates minimum SDK version to Flutter 3.0.
## 1.0.6 ## 1.0.6

View File

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

View File

@ -1,5 +1,5 @@
name: metrics_center name: metrics_center
version: 1.0.6 version: 1.0.7
description: description:
Support multiple performance metrics sources/formats and destinations. Support multiple performance metrics sources/formats and destinations.
repository: https://github.com/flutter/packages/tree/main/packages/metrics_center 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 ## 7.1.4
* [java] Fixes raw types lint issues. * [java] Fixes raw types lint issues.

View File

@ -11,7 +11,7 @@ import 'ast.dart';
/// The current version of pigeon. /// The current version of pigeon.
/// ///
/// This must match the version in pubspec.yaml. /// 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. /// Read all the content from [stdin] to a String.
String readStdin() { String readStdin() {

View File

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

View File

@ -2,7 +2,7 @@
// 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
// ignore_for_file: avoid_relative_lib_imports // 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 // 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
package com.example.alternate_language_test_plugin; 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 // 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
#import <Foundation/Foundation.h> #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 // 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
#import "CoreTests.gen.h" #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 // 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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 // 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 // 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.
// //
// 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 // 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 // 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)) 'dev.flutter.pigeon.MultipleArityHostApi.subtract', any))
.thenAnswer((Invocation realInvocation) async { .thenAnswer((Invocation realInvocation) async {
final Object input = MultipleArityHostApi.codec final Object input = MultipleArityHostApi.codec
.decodeMessage(realInvocation.positionalArguments[1])!; .decodeMessage(realInvocation.positionalArguments[1] as ByteData?)!;
final List<Object?> args = input as List<Object?>; final List<Object?> args = input as List<Object?>;
final int x = (args[0] as int?)!; final int x = (args[0] as int?)!;
final int y = (args[1] as int?)!; final int y = (args[1] as int?)!;

View File

@ -12,8 +12,8 @@ void echoOneArgument(
) { ) {
when(mockMessenger.send(channel, any)) when(mockMessenger.send(channel, any))
.thenAnswer((Invocation realInvocation) async { .thenAnswer((Invocation realInvocation) async {
final Object input = final Object input = codec
codec.decodeMessage(realInvocation.positionalArguments[1])!; .decodeMessage(realInvocation.positionalArguments[1] as ByteData?)!;
final List<Object?> args = input as List<Object?>; final List<Object?> args = input as List<Object?>;
return codec.encodeMessage(<Object>[args[0]!]); 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 // 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.
// //
// 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 // 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 // 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. // Copyright 2013 The Flutter Authors. All rights reserved.
// 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
package com.example.test_plugin package com.example.test_plugin

View File

@ -1,8 +1,8 @@
// Copyright 2013 The Flutter Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
import Foundation import Foundation
@ -117,23 +117,23 @@ struct AllNullableTypes {
var aNullableString: String? = nil var aNullableString: String? = nil
static func fromList(_ list: [Any?]) -> AllNullableTypes? { static func fromList(_ list: [Any?]) -> AllNullableTypes? {
let aNullableBool = list[0] as? Bool let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32 let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?] let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?] let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?] let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?] let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?] let nullableMapWithObject = list[11] as? [String?: Any?]
var aNullableEnum: AnEnum? = nil var aNullableEnum: AnEnum? = nil
if let aNullableEnumRawValue = list[12] as? Int { if let aNullableEnumRawValue = list[12] as? Int {
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue) aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
} }
let aNullableString = list[13] as? String let aNullableString = list[13] as? String
return AllNullableTypes( return AllNullableTypes(
aNullableBool: aNullableBool, aNullableBool: aNullableBool,

View File

@ -1,8 +1,8 @@
// Copyright 2013 The Flutter Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
import Foundation import Foundation
@ -117,23 +117,23 @@ struct AllNullableTypes {
var aNullableString: String? = nil var aNullableString: String? = nil
static func fromList(_ list: [Any?]) -> AllNullableTypes? { static func fromList(_ list: [Any?]) -> AllNullableTypes? {
let aNullableBool = list[0] as? Bool let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32 let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?] let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?] let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?] let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?] let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?] let nullableMapWithObject = list[11] as? [String?: Any?]
var aNullableEnum: AnEnum? = nil var aNullableEnum: AnEnum? = nil
if let aNullableEnumRawValue = list[12] as? Int { if let aNullableEnumRawValue = list[12] as? Int {
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue) aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
} }
let aNullableString = list[13] as? String let aNullableString = list[13] as? String
return AllNullableTypes( return AllNullableTypes(
aNullableBool: aNullableBool, aNullableBool: aNullableBool,

View File

@ -2,7 +2,7 @@
// 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
#undef _HAS_EXCEPTIONS #undef _HAS_EXCEPTIONS

View File

@ -2,7 +2,7 @@
// 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.
// //
// 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 // See also: https://pub.dev/packages/pigeon
#ifndef PIGEON_CORE_TESTS_GEN_H_ #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. 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 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 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: environment:
sdk: ">=2.12.0 <3.0.0" 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}'''); ${parser.usage}''');
exit(0); exit(0);
} else if (argResults.wasParsed(_testFlag)) { } 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 // 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 ## 1.0.7
* Update README. * Update README.

View File

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

View File

@ -394,7 +394,7 @@ void main() {
await tester.pump(); await tester.pump();
expect(tester.widget<ColoredBox>(find.byType(ColoredBox)).color, const Color(0xFF000000)); 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(); await tester.pump();
expect(tester.widget<ColoredBox>(find.byType(ColoredBox)).color, const Color(0x00000001)); 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 ## 0.1.0+1
* Fixes lint warnings. * Fixes lint warnings.

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ name: web_benchmarks
description: A benchmark harness for performance-testing Flutter apps in Chrome. description: A benchmark harness for performance-testing Flutter apps in Chrome.
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks 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 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: environment:
sdk: '>=2.17.0 <3.0.0' sdk: '>=2.17.0 <3.0.0'

View File

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