Skip to content

Commit

Permalink
Use strict analysis mode
Browse files Browse the repository at this point in the history
  • Loading branch information
amake committed Sep 21, 2023
1 parent 62cd449 commit 0ae172b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 23 deletions.
7 changes: 4 additions & 3 deletions flutter_charset_detector/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();

setUp(() {
channel.setMockMethodCallHandler((methodCall) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (methodCall) async {
switch (methodCall.method) {
case 'autoDecode':
final args = methodCall.arguments as Map;
Expand All @@ -25,7 +26,8 @@ void main() {
});

tearDown(() {
channel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, null);
});

test('testAutoDecode', () async {
Expand Down
7 changes: 4 additions & 3 deletions flutter_charset_detector_android/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class CharsetDetectorAndroid extends CharsetDetectorPlatform {
/// Automatically detect the charset of [bytes] and decode to a string.
@override
Future<DecodingResult> autoDecode(Uint8List bytes) async {
final result =
await _channel.invokeMethod<Map>('autoDecode', {'data': bytes}) as Map;
return DecodingResult.fromJson(result.cast<String, dynamic>());
final result = await _channel
.invokeMethod<Map<String, dynamic>>('autoDecode', {'data': bytes});
return DecodingResult.fromJson(result!);
}
}
7 changes: 4 additions & 3 deletions flutter_charset_detector_ios/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class CharsetDetectorIOS extends CharsetDetectorPlatform {
/// Automatically detect the charset of [bytes] and decode to a string.
@override
Future<DecodingResult> autoDecode(Uint8List bytes) async {
final result =
await _channel.invokeMethod<Map>('autoDecode', {'data': bytes}) as Map;
return DecodingResult.fromJson(result.cast<String, dynamic>());
final result = await _channel
.invokeMethod<Map<String, dynamic>>('autoDecode', {'data': bytes});
return DecodingResult.fromJson(result!);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class MethodChannelCharsetDetector extends CharsetDetectorPlatform {
/// Automatically detect the charset of [bytes] and decode to a string.
@override
Future<DecodingResult> autoDecode(Uint8List bytes) async {
final result =
await _channel.invokeMethod<Map>('autoDecode', {'data': bytes}) as Map;
return DecodingResult.fromJson(result.cast<String, dynamic>());
final result = await _channel
.invokeMethod<Map<String, dynamic>>('autoDecode', {'data': bytes});
return DecodingResult.fromJson(result!);
}
}

0 comments on commit 0ae172b

Please sign in to comment.