Reland implicit-casts: false (#47431)
This commit is contained in:
parent
4af66e335f
commit
78db965642
@ -20,6 +20,7 @@
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
errors:
|
||||
# treat missing required parameters as a warning (not a hint)
|
||||
|
@ -20,7 +20,7 @@ class FastScrollLargeImagesMemoryTest extends MemoryTest {
|
||||
);
|
||||
|
||||
@override
|
||||
AndroidDevice get device => super.device;
|
||||
AndroidDevice get device => super.device as AndroidDevice;
|
||||
|
||||
@override
|
||||
int get iterationCount => 5;
|
||||
|
@ -4,10 +4,11 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io' show File;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
const String _kPathParent = 'test_driver/goldens/';
|
||||
|
||||
@ -43,8 +44,7 @@ class DriverScreenShotTester {
|
||||
Future<bool> compareScreenshots(List<int> screenshot) async {
|
||||
final File file = File(_getImageFilePath());
|
||||
final List<int> matcher = await file.readAsBytes();
|
||||
final Function listEquals = const ListEquality<int>().equals;
|
||||
return listEquals(screenshot, matcher);
|
||||
return listEquals<int>(screenshot, matcher);
|
||||
}
|
||||
|
||||
/// Returns a bytes representation of a screenshot on the current screen.
|
||||
|
@ -53,10 +53,10 @@ Future<void> main(List<String> arguments) async {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
final String arbPathString = results['arb-dir'];
|
||||
final String outputFileString = results['output-localization-file'];
|
||||
final String templateArbFileName = results['template-arb-file'];
|
||||
final String classNameString = results['output-class'];
|
||||
final String arbPathString = results['arb-dir'] as String;
|
||||
final String outputFileString = results['output-localization-file'] as String;
|
||||
final String templateArbFileName = results['template-arb-file'] as String;
|
||||
final String classNameString = results['output-class'] as String;
|
||||
|
||||
const local.LocalFileSystem fs = local.LocalFileSystem();
|
||||
final LocalizationsGenerator localizationsGenerator = LocalizationsGenerator(fs);
|
||||
|
@ -214,10 +214,7 @@ const Set<String> allowableDateFormats = <String>{
|
||||
's',
|
||||
};
|
||||
|
||||
bool _isDateParameter(dynamic placeholderValue) {
|
||||
return placeholderValue is Map<String, dynamic> &&
|
||||
placeholderValue['type'] == 'DateTime';
|
||||
}
|
||||
bool _isDateParameter(Map<String, dynamic> placeholderValue) => placeholderValue['type'] == 'DateTime';
|
||||
|
||||
bool _dateParameterIsValid(Map<String, dynamic> placeholderValue, String placeholder) {
|
||||
if (allowableDateFormats.contains(placeholderValue['format']))
|
||||
@ -260,6 +257,7 @@ String generateDateFormattingLogic(Map<String, dynamic> bundle, String key) {
|
||||
for (String placeholder in placeholders.keys) {
|
||||
final dynamic value = placeholders[placeholder];
|
||||
if (
|
||||
value is Map<String, dynamic> &&
|
||||
_isDateParameter(value) &&
|
||||
_containsFormatKey(value, placeholder) &&
|
||||
_dateParameterIsValid(value, placeholder)
|
||||
@ -291,6 +289,7 @@ List<String> genIntlMethodArgs(Map<String, dynamic> bundle, String key) {
|
||||
for (String placeholder in placeholders.keys) {
|
||||
final dynamic value = placeholders[placeholder];
|
||||
if (
|
||||
value is Map<String, dynamic> &&
|
||||
_isDateParameter(value) &&
|
||||
_containsFormatKey(value, placeholder) &&
|
||||
_dateParameterIsValid(value, placeholder)
|
||||
@ -315,7 +314,7 @@ String genSimpleMethod(Map<String, dynamic> bundle, String key) {
|
||||
final Map<String, dynamic> placeholders = attributesMap['placeholders'] as Map<String, dynamic>;
|
||||
for (String placeholder in placeholders.keys) {
|
||||
final dynamic value = placeholders[placeholder];
|
||||
if (_isDateParameter(value)) {
|
||||
if (value is Map<String, dynamic> && _isDateParameter(value)) {
|
||||
message = message.replaceAll('{$placeholder}', '\$${placeholder}String');
|
||||
} else {
|
||||
message = message.replaceAll('{$placeholder}', '\$$placeholder');
|
||||
@ -599,8 +598,8 @@ class LocalizationsGenerator {
|
||||
for (File file in fileSystemEntityList) {
|
||||
final String filePath = file.path;
|
||||
if (arbFilenameRE.hasMatch(filePath)) {
|
||||
final Map<String, dynamic> arbContents = json.decode(file.readAsStringSync());
|
||||
String localeString = arbContents['@@locale'];
|
||||
final Map<String, dynamic> arbContents = json.decode(file.readAsStringSync()) as Map<String, dynamic>;
|
||||
String localeString = arbContents['@@locale'] as String;
|
||||
if (localeString == null) {
|
||||
final RegExpMatch arbFileMatch = arbFilenameLocaleRE.firstMatch(filePath);
|
||||
if (arbFileMatch == null) {
|
||||
@ -653,7 +652,7 @@ class LocalizationsGenerator {
|
||||
void generateClassMethods() {
|
||||
Map<String, dynamic> bundle;
|
||||
try {
|
||||
bundle = json.decode(templateArbFile.readAsStringSync());
|
||||
bundle = json.decode(templateArbFile.readAsStringSync()) as Map<String, dynamic>;
|
||||
} on FileSystemException catch (e) {
|
||||
throw FileSystemException('Unable to read input arb file: $e');
|
||||
} on FormatException catch (e) {
|
||||
@ -669,7 +668,7 @@ class LocalizationsGenerator {
|
||||
'Invalid key format: $key \n It has to be in camel case, cannot start '
|
||||
'with a number, and cannot contain non-alphanumeric characters.'
|
||||
);
|
||||
if (pluralValueRE.hasMatch(bundle[key]))
|
||||
if (pluralValueRE.hasMatch(bundle[key] as String))
|
||||
classMethods.add(genPluralMethod(bundle, key));
|
||||
else
|
||||
classMethods.add(genSimpleMethod(bundle, key));
|
||||
|
@ -314,7 +314,7 @@ class MouseTracker extends ChangeNotifier {
|
||||
final int device = state.device;
|
||||
return (_mouseStates.containsKey(device) && _trackedAnnotations.isNotEmpty)
|
||||
? LinkedHashSet<MouseTrackerAnnotation>.from(annotationFinder(globalPosition))
|
||||
: <MouseTrackerAnnotation>{};
|
||||
: <MouseTrackerAnnotation>{} as LinkedHashSet<MouseTrackerAnnotation>;
|
||||
}
|
||||
|
||||
static bool get _duringBuildPhase {
|
||||
|
@ -530,7 +530,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
|
||||
return _dragging == toAccept && toAccept != toWrap.key;
|
||||
},
|
||||
onAccept: (Key accepted) { },
|
||||
onLeave: (Key leaving) { },
|
||||
onLeave: (Object leaving) { },
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -162,12 +162,12 @@ abstract class EdgeInsetsGeometry {
|
||||
/// or equal to `min`, and less than or equal to `max`.
|
||||
EdgeInsetsGeometry clamp(EdgeInsetsGeometry min, EdgeInsetsGeometry max) {
|
||||
return _MixedEdgeInsets.fromLRSETB(
|
||||
_left.clamp(min._left, max._left),
|
||||
_right.clamp(min._right, max._right),
|
||||
_start.clamp(min._start, max._start),
|
||||
_end.clamp(min._end, max._end),
|
||||
_top.clamp(min._top, max._top),
|
||||
_bottom.clamp(min._bottom, max._bottom),
|
||||
_left.clamp(min._left, max._left) as double,
|
||||
_right.clamp(min._right, max._right) as double,
|
||||
_start.clamp(min._start, max._start) as double,
|
||||
_end.clamp(min._end, max._end) as double,
|
||||
_top.clamp(min._top, max._top) as double,
|
||||
_bottom.clamp(min._bottom, max._bottom) as double,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -672,9 +672,9 @@ class PlatformViewLayer extends Layer {
|
||||
if (hoverAnnotation == null || !rect.contains(localPosition)) {
|
||||
return false;
|
||||
}
|
||||
if (MouseTrackerAnnotation == S) {
|
||||
if (S == MouseTrackerAnnotation) {
|
||||
final Object untypedValue = hoverAnnotation;
|
||||
final S typedValue = untypedValue;
|
||||
final S typedValue = untypedValue as S;
|
||||
result.add(AnnotationEntry<S>(
|
||||
annotation: typedValue,
|
||||
localPosition: localPosition,
|
||||
|
@ -7,6 +7,7 @@ import 'dart:ui' as ui show Color;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
|
||||
import 'layer.dart';
|
||||
import 'object.dart';
|
||||
import 'sliver.dart';
|
||||
|
||||
@ -71,7 +72,7 @@ abstract class RenderProxySliver extends RenderSliver with RenderObjectWithChild
|
||||
@override
|
||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
||||
assert(child != null);
|
||||
final SliverPhysicalParentData childParentData = child.parentData;
|
||||
final SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
|
||||
childParentData.applyPaintTransform(transform);
|
||||
}
|
||||
}
|
||||
@ -169,7 +170,7 @@ class RenderSliverOpacity extends RenderProxySliver {
|
||||
offset,
|
||||
_alpha,
|
||||
_paintWithOpacity,
|
||||
oldLayer: layer,
|
||||
oldLayer: layer as OpacityLayer,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
|
||||
registerServiceExtension(
|
||||
name: 'fastReassemble',
|
||||
callback: (Map<String, Object> params) async {
|
||||
final String className = params['class'];
|
||||
final String className = params['class'] as String;
|
||||
void markElementsDirty(Element element) {
|
||||
if (element == null) {
|
||||
return;
|
||||
|
@ -48,7 +48,7 @@ typedef DragEndCallback = void Function(DraggableDetails details);
|
||||
/// Signature for when a [Draggable] leaves a [DragTarget].
|
||||
///
|
||||
/// Used by [DragTarget.onLeave].
|
||||
typedef DragTargetLeave<T> = void Function(T data);
|
||||
typedef DragTargetLeave = void Function(Object data);
|
||||
|
||||
/// Where the [Draggable] should be anchored during a drag.
|
||||
enum DragAnchor {
|
||||
@ -502,7 +502,7 @@ class DragTarget<T> extends StatefulWidget {
|
||||
|
||||
/// Called when a given piece of data being dragged over this target leaves
|
||||
/// the target.
|
||||
final DragTargetLeave<T> onLeave;
|
||||
final DragTargetLeave onLeave;
|
||||
|
||||
@override
|
||||
_DragTargetState<T> createState() => _DragTargetState<T>();
|
||||
@ -514,13 +514,12 @@ List<T> _mapAvatarsToData<T>(List<_DragAvatar<T>> avatars) {
|
||||
|
||||
class _DragTargetState<T> extends State<DragTarget<T>> {
|
||||
final List<_DragAvatar<T>> _candidateAvatars = <_DragAvatar<T>>[];
|
||||
final List<_DragAvatar<dynamic>> _rejectedAvatars = <_DragAvatar<dynamic>>[];
|
||||
final List<_DragAvatar<Object>> _rejectedAvatars = <_DragAvatar<Object>>[];
|
||||
|
||||
bool didEnter(_DragAvatar<dynamic> avatar) {
|
||||
bool didEnter(_DragAvatar<Object> avatar) {
|
||||
assert(!_candidateAvatars.contains(avatar));
|
||||
assert(!_rejectedAvatars.contains(avatar));
|
||||
final dynamic data = avatar.data;
|
||||
if (data is T && (widget.onWillAccept == null || widget.onWillAccept(data))) {
|
||||
if (avatar is _DragAvatar<T> && (widget.onWillAccept == null || widget.onWillAccept(avatar.data))) {
|
||||
setState(() {
|
||||
_candidateAvatars.add(avatar);
|
||||
});
|
||||
@ -533,7 +532,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
|
||||
}
|
||||
}
|
||||
|
||||
void didLeave(_DragAvatar<dynamic> avatar) {
|
||||
void didLeave(_DragAvatar<Object> avatar) {
|
||||
assert(_candidateAvatars.contains(avatar) || _rejectedAvatars.contains(avatar));
|
||||
if (!mounted)
|
||||
return;
|
||||
@ -545,7 +544,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
|
||||
widget.onLeave(avatar.data);
|
||||
}
|
||||
|
||||
void didDrop(_DragAvatar<dynamic> avatar) {
|
||||
void didDrop(_DragAvatar<Object> avatar) {
|
||||
assert(_candidateAvatars.contains(avatar));
|
||||
if (!mounted)
|
||||
return;
|
||||
@ -553,7 +552,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
|
||||
_candidateAvatars.remove(avatar);
|
||||
});
|
||||
if (widget.onAccept != null)
|
||||
widget.onAccept(avatar.data);
|
||||
widget.onAccept(avatar.data as T);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -562,7 +561,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
|
||||
return MetaData(
|
||||
metaData: this,
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: widget.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData<dynamic>(_rejectedAvatars)),
|
||||
child: widget.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData<Object>(_rejectedAvatars)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -90,13 +90,21 @@ void main() {
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return Container(height: 100.0, child: const Text('Target 1'));
|
||||
},
|
||||
onLeave: (int data) => leftBehind['Target 1'] = leftBehind['Target 1'] + data,
|
||||
onLeave: (Object data) {
|
||||
if (data is int) {
|
||||
leftBehind['Target 1'] = leftBehind['Target 1'] + data;
|
||||
}
|
||||
},
|
||||
),
|
||||
DragTarget<int>(
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return Container(height: 100.0, child: const Text('Target 2'));
|
||||
},
|
||||
onLeave: (int data) => leftBehind['Target 2'] = leftBehind['Target 2'] + data,
|
||||
onLeave: (Object data) {
|
||||
if (data is int) {
|
||||
leftBehind['Target 2'] = leftBehind['Target 2'] + data;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Override the parent analysis_options until all the repo has implicit-casts: false
|
||||
|
||||
include: ../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
@ -2,8 +2,3 @@
|
||||
# the ones from above, which include the `public_member_api_docs` rule).
|
||||
|
||||
include: ../../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
@ -2,8 +2,3 @@
|
||||
# the ones from above, which include the `public_member_api_docs` rule).
|
||||
|
||||
include: ../../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
@ -1,12 +0,0 @@
|
||||
# Override the parent analysis_options until all the repo has implicit-casts: false
|
||||
|
||||
include: ../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
||||
linter:
|
||||
rules:
|
||||
avoid_as: false
|
@ -1,6 +0,0 @@
|
||||
include: ../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
@ -3,11 +3,6 @@
|
||||
|
||||
include: ../../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
||||
linter:
|
||||
rules:
|
||||
unawaited_futures: true
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Override the parent analysis_options until all the repo has implicit-casts: false
|
||||
|
||||
include: ../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
@ -1,8 +0,0 @@
|
||||
# Override the parent analysis_options until all the repo has implicit-casts: false
|
||||
|
||||
include: ../analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
Loading…
x
Reference in New Issue
Block a user