Unverified Commit efbde443 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Clean up ignores that are not ignoring anything (#78484)

parent 51dbc768
...@@ -1304,7 +1304,6 @@ class ElasticInOutCurve extends Curve { ...@@ -1304,7 +1304,6 @@ class ElasticInOutCurve extends Curve {
class Curves { class Curves {
// This class is not meant to be instatiated or extended; this constructor // This class is not meant to be instatiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
Curves._(); Curves._();
/// A linear animation curve. /// A linear animation curve.
......
...@@ -20,7 +20,6 @@ import 'theme.dart'; ...@@ -20,7 +20,6 @@ import 'theme.dart';
class CupertinoColors { class CupertinoColors {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
CupertinoColors._(); CupertinoColors._();
/// iOS 13's default blue color. Used to indicate active elements such as /// iOS 13's default blue color. Used to indicate active elements such as
......
...@@ -33,7 +33,6 @@ import 'package:flutter/widgets.dart'; ...@@ -33,7 +33,6 @@ import 'package:flutter/widgets.dart';
class CupertinoIcons { class CupertinoIcons {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
CupertinoIcons._(); CupertinoIcons._();
/// The icon font used for Cupertino icons. /// The icon font used for Cupertino icons.
......
...@@ -211,10 +211,7 @@ mixin CupertinoRouteTransitionMixin<T> on PageRoute<T> { ...@@ -211,10 +211,7 @@ mixin CupertinoRouteTransitionMixin<T> on PageRoute<T> {
child: child, child: child,
); );
assert(() { assert(() {
// `child` has a non-nullable return type, but might be null when if (child == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (child == null) { // ignore: dead_code
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The builder for route "${settings.name}" returned null.'), ErrorSummary('The builder for route "${settings.name}" returned null.'),
ErrorDescription('Route builders must never return null.'), ErrorDescription('Route builders must never return null.'),
......
...@@ -358,8 +358,7 @@ class _CupertinoTextSelectionToolbarContent extends StatefulWidget { ...@@ -358,8 +358,7 @@ class _CupertinoTextSelectionToolbarContent extends StatefulWidget {
required this.toolbarBuilder, required this.toolbarBuilder,
required this.children, required this.children,
}) : assert(children != null), }) : assert(children != null),
// This ignore is used because .isNotEmpty isn't compatible with const. assert(children.length > 0),
assert(children.length > 0), // ignore: prefer_is_empty
super(key: key); super(key: key);
final Offset anchor; final Offset anchor;
......
...@@ -44,6 +44,4 @@ typedef _ComputeImpl = Future<R> Function<Q, R>(ComputeCallback<Q, R> callback, ...@@ -44,6 +44,4 @@ typedef _ComputeImpl = Future<R> Function<Q, R>(ComputeCallback<Q, R> callback,
/// ///
/// The `debugLabel` argument can be specified to provide a name to add to the /// The `debugLabel` argument can be specified to provide a name to add to the
/// [Timeline]. This is useful when profiling an application. /// [Timeline]. This is useful when profiling an application.
// Remove when https://github.com/dart-lang/sdk/issues/37149 is fixed. const _ComputeImpl compute = _isolates.compute;
// ignore: prefer_const_declarations
final _ComputeImpl compute = _isolates.compute;
...@@ -288,7 +288,6 @@ class LicenseEntryWithLineBreaks extends LicenseEntry { ...@@ -288,7 +288,6 @@ class LicenseEntryWithLineBreaks extends LicenseEntry {
class LicenseRegistry { class LicenseRegistry {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
LicenseRegistry._(); LicenseRegistry._();
static List<LicenseEntryCollector>? _collectors; static List<LicenseEntryCollector>? _collectors;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
class Unicode { class Unicode {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
Unicode._(); Unicode._();
/// `U+202A LEFT-TO-RIGHT EMBEDDING` /// `U+202A LEFT-TO-RIGHT EMBEDDING`
/// ///
......
...@@ -35,7 +35,6 @@ int _synthesiseDownButtons(int buttons, PointerDeviceKind kind) { ...@@ -35,7 +35,6 @@ int _synthesiseDownButtons(int buttons, PointerDeviceKind kind) {
class PointerEventConverter { class PointerEventConverter {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
PointerEventConverter._(); PointerEventConverter._();
/// Expand the given packet of pointer data into a sequence of framework /// Expand the given packet of pointer data into a sequence of framework
......
...@@ -62,7 +62,6 @@ const Icon _kDefaultDeleteIcon = Icon(Icons.cancel, size: _kDeleteIconSize); ...@@ -62,7 +62,6 @@ const Icon _kDefaultDeleteIcon = Icon(Icons.cancel, size: _kDeleteIconSize);
abstract class ChipAttributes { abstract class ChipAttributes {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
ChipAttributes._(); ChipAttributes._();
/// The primary content of the chip. /// The primary content of the chip.
...@@ -203,7 +202,6 @@ abstract class ChipAttributes { ...@@ -203,7 +202,6 @@ abstract class ChipAttributes {
abstract class DeletableChipAttributes { abstract class DeletableChipAttributes {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
DeletableChipAttributes._(); DeletableChipAttributes._();
/// The icon displayed when [onDeleted] is set. /// The icon displayed when [onDeleted] is set.
...@@ -315,7 +313,6 @@ abstract class DeletableChipAttributes { ...@@ -315,7 +313,6 @@ abstract class DeletableChipAttributes {
abstract class CheckmarkableChipAttributes { abstract class CheckmarkableChipAttributes {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
CheckmarkableChipAttributes._(); CheckmarkableChipAttributes._();
/// Whether or not to show a check mark when /// Whether or not to show a check mark when
...@@ -351,7 +348,6 @@ abstract class CheckmarkableChipAttributes { ...@@ -351,7 +348,6 @@ abstract class CheckmarkableChipAttributes {
abstract class SelectableChipAttributes { abstract class SelectableChipAttributes {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
SelectableChipAttributes._(); SelectableChipAttributes._();
/// Whether or not this chip is selected. /// Whether or not this chip is selected.
...@@ -462,7 +458,6 @@ abstract class SelectableChipAttributes { ...@@ -462,7 +458,6 @@ abstract class SelectableChipAttributes {
abstract class DisabledChipAttributes { abstract class DisabledChipAttributes {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
DisabledChipAttributes._(); DisabledChipAttributes._();
/// Whether or not this chip is enabled for input. /// Whether or not this chip is enabled for input.
...@@ -510,7 +505,6 @@ abstract class DisabledChipAttributes { ...@@ -510,7 +505,6 @@ abstract class DisabledChipAttributes {
abstract class TappableChipAttributes { abstract class TappableChipAttributes {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
TappableChipAttributes._(); TappableChipAttributes._();
/// Called when the user taps the chip. /// Called when the user taps the chip.
......
...@@ -196,7 +196,6 @@ class MaterialAccentColor extends ColorSwatch<int> { ...@@ -196,7 +196,6 @@ class MaterialAccentColor extends ColorSwatch<int> {
class Colors { class Colors {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
Colors._(); Colors._();
/// Completely invisible. /// Completely invisible.
......
...@@ -13,7 +13,6 @@ import 'theme.dart'; ...@@ -13,7 +13,6 @@ import 'theme.dart';
class ElevationOverlay { class ElevationOverlay {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
ElevationOverlay._(); ElevationOverlay._();
/// Applies an overlay color to a surface color to indicate /// Applies an overlay color to a surface color to indicate
......
...@@ -84,7 +84,6 @@ import 'theme.dart'; ...@@ -84,7 +84,6 @@ import 'theme.dart';
class Feedback { class Feedback {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
Feedback._(); Feedback._();
/// Provides platform-specific feedback for a tap. /// Provides platform-specific feedback for a tap.
......
...@@ -134,7 +134,6 @@ class _PlatformAdaptiveIcons { ...@@ -134,7 +134,6 @@ class _PlatformAdaptiveIcons {
class Icons { class Icons {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
Icons._(); Icons._();
/// A set of platform-adaptive material design icons. /// A set of platform-adaptive material design icons.
...@@ -434,10 +434,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -434,10 +434,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
)); ));
return true; return true;
}()); }());
// `refreshResult` has a non-nullable type, but might be null when if (refreshResult == null)
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (refreshResult == null) // ignore: dead_code
return; return;
refreshResult.whenComplete(() { refreshResult.whenComplete(() {
if (mounted && _mode == _RefreshIndicatorMode.refresh) { if (mounted && _mode == _RefreshIndicatorMode.refresh) {
......
...@@ -92,7 +92,7 @@ class NetworkImage ...@@ -92,7 +92,7 @@ class NetworkImage
chunkCallback: (int bytes, int total) { chunkCallback: (int bytes, int total) {
chunkEvents.add(ImageChunkEvent( chunkEvents.add(ImageChunkEvent(
cumulativeBytesLoaded: bytes, expectedTotalBytes: total)); cumulativeBytesLoaded: bytes, expectedTotalBytes: total));
}) as Future<ui.Codec>; // ignore: undefined_function }) as Future<ui.Codec>;
} }
@override @override
......
...@@ -674,10 +674,7 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe ...@@ -674,10 +674,7 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe
PaintingBinding.instance!.imageCache!.evict(key); PaintingBinding.instance!.imageCache!.evict(key);
rethrow; rethrow;
} }
// `key.bundle.load` has a non-nullable return type, but might be null when if (data == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (data == null) { // ignore: dead_code
PaintingBinding.instance!.imageCache!.evict(key); PaintingBinding.instance!.imageCache!.evict(key);
throw StateError('Unable to read data'); throw StateError('Unable to read data');
} }
......
...@@ -14,7 +14,6 @@ import 'basic_types.dart'; ...@@ -14,7 +14,6 @@ import 'basic_types.dart';
class MatrixUtils { class MatrixUtils {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
MatrixUtils._(); MatrixUtils._();
/// Returns the given [transform] matrix as an [Offset], if the matrix is /// Returns the given [transform] matrix as an [Offset], if the matrix is
......
...@@ -343,10 +343,7 @@ class TextSpan extends InlineSpan { ...@@ -343,10 +343,7 @@ class TextSpan extends InlineSpan {
assert(() { assert(() {
if (children != null) { if (children != null) {
for (final InlineSpan child in children!) { for (final InlineSpan child in children!) {
// `child` has a non-nullable return type, but might be null when if (child == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (child == null) { // ignore: dead_code
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('TextSpan contains a null child.'), ErrorSummary('TextSpan contains a null child.'),
ErrorDescription( ErrorDescription(
...@@ -459,7 +456,7 @@ class TextSpan extends InlineSpan { ...@@ -459,7 +456,7 @@ class TextSpan extends InlineSpan {
// warning that the null-handling logic is dead code). // warning that the null-handling logic is dead code).
if (child != null) { if (child != null) {
return child.toDiagnosticsNode(); return child.toDiagnosticsNode();
} else { // ignore: dead_code } else {
return DiagnosticsNode.message('<null child>'); return DiagnosticsNode.message('<null child>');
} }
}).toList(); }).toList();
......
...@@ -1398,10 +1398,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1398,10 +1398,7 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper @mustCallSuper
double getMinIntrinsicWidth(double height) { double getMinIntrinsicWidth(double height) {
assert(() { assert(() {
// `height` has a non-nullable return type, but might be null when if (height == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (height == null) { // ignore: dead_code
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The height argument to getMinIntrinsicWidth was null.'), ErrorSummary('The height argument to getMinIntrinsicWidth was null.'),
ErrorDescription('The argument to getMinIntrinsicWidth must not be negative or null.'), ErrorDescription('The argument to getMinIntrinsicWidth must not be negative or null.'),
...@@ -1550,10 +1547,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1550,10 +1547,7 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper @mustCallSuper
double getMaxIntrinsicWidth(double height) { double getMaxIntrinsicWidth(double height) {
assert(() { assert(() {
// `height` has a non-nullable return type, but might be null when if (height == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (height == null) { // ignore: dead_code
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The height argument to getMaxIntrinsicWidth was null.'), ErrorSummary('The height argument to getMaxIntrinsicWidth was null.'),
ErrorDescription('The argument to getMaxIntrinsicWidth must not be negative or null.'), ErrorDescription('The argument to getMaxIntrinsicWidth must not be negative or null.'),
...@@ -1636,10 +1630,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1636,10 +1630,7 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper @mustCallSuper
double getMinIntrinsicHeight(double width) { double getMinIntrinsicHeight(double width) {
assert(() { assert(() {
// `width` has a non-nullable return type, but might be null when if (width == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (width == null) { // ignore: dead_code
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The width argument to getMinIntrinsicHeight was null.'), ErrorSummary('The width argument to getMinIntrinsicHeight was null.'),
ErrorDescription('The argument to getMinIntrinsicHeight must not be negative or null.'), ErrorDescription('The argument to getMinIntrinsicHeight must not be negative or null.'),
...@@ -1721,10 +1712,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1721,10 +1712,7 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper @mustCallSuper
double getMaxIntrinsicHeight(double width) { double getMaxIntrinsicHeight(double width) {
assert(() { assert(() {
// `width` has a non-nullable return type, but might be null when if (width == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (width == null) { // ignore: dead_code
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The width argument to getMaxIntrinsicHeight was null.'), ErrorSummary('The width argument to getMaxIntrinsicHeight was null.'),
ErrorDescription('The argument to getMaxIntrinsicHeight must not be negative or null.'), ErrorDescription('The argument to getMaxIntrinsicHeight must not be negative or null.'),
......
...@@ -187,10 +187,7 @@ abstract class MultiChildLayoutDelegate { ...@@ -187,10 +187,7 @@ abstract class MultiChildLayoutDelegate {
'There is no child with the id "$childId".' 'There is no child with the id "$childId".'
); );
} }
// `offset` has a non-nullable return type, but might be null when if (offset == null) {
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (offset == null) { // ignore: dead_code
throw FlutterError( throw FlutterError(
'The $this custom multichild layout delegate provided a null position for the child with id "$childId".' 'The $this custom multichild layout delegate provided a null position for the child with id "$childId".'
); );
......
...@@ -1499,10 +1499,7 @@ class RenderClipRRect extends _RenderCustomClip<RRect> { ...@@ -1499,10 +1499,7 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
assert(clipBehavior != Clip.none), assert(clipBehavior != Clip.none),
_borderRadius = borderRadius, _borderRadius = borderRadius,
super(child: child, clipper: clipper, clipBehavior: clipBehavior) { super(child: child, clipper: clipper, clipBehavior: clipBehavior) {
// `_borderRadius` has a non-nullable return type, but might be null when assert(_borderRadius != null || clipper != null);
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
assert(_borderRadius != null || clipper != null);// ignore: dead_code
} }
/// The border radius of the rounded corners. /// The border radius of the rounded corners.
......
...@@ -32,7 +32,6 @@ enum CacheExtentStyle { ...@@ -32,7 +32,6 @@ enum CacheExtentStyle {
abstract class RenderAbstractViewport extends RenderObject { abstract class RenderAbstractViewport extends RenderObject {
// This class is intended to be used as an interface, and should not be // This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension. // extended directly; this constructor prevents instantiation and extension.
// ignore: unused_element
factory RenderAbstractViewport._() => throw Error(); factory RenderAbstractViewport._() => throw Error();
/// Returns the [RenderAbstractViewport] that most tightly encloses the given /// Returns the [RenderAbstractViewport] that most tightly encloses the given
......
...@@ -20,7 +20,6 @@ import 'semantics_event.dart' show AnnounceSemanticsEvent, TooltipSemanticsEvent ...@@ -20,7 +20,6 @@ import 'semantics_event.dart' show AnnounceSemanticsEvent, TooltipSemanticsEvent
class SemanticsService { class SemanticsService {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
SemanticsService._(); SemanticsService._();
/// Sends a semantic announcement. /// Sends a semantic announcement.
......
...@@ -66,11 +66,8 @@ abstract class AssetBundle { ...@@ -66,11 +66,8 @@ abstract class AssetBundle {
/// implementation.) /// implementation.)
Future<String> loadString(String key, { bool cache = true }) async { Future<String> loadString(String key, { bool cache = true }) async {
final ByteData data = await load(key); final ByteData data = await load(key);
// Note: data has a non-nullable type, but might be null when running with
// weak checking, so we need to null check it anyway (and ignore the warning
// that the null-handling logic is dead code).
if (data == null) if (data == null)
throw FlutterError('Unable to load asset: $key'); // ignore: dead_code throw FlutterError('Unable to load asset: $key');
// 50 KB of data should take 2-3 ms to parse on a Moto G4, and about 400 μs // 50 KB of data should take 2-3 ms to parse on a Moto G4, and about 400 μs
// on a Pixel 4. // on a Pixel 4.
if (data.lengthInBytes < 50 * 1024) { if (data.lengthInBytes < 50 * 1024) {
......
...@@ -24,7 +24,6 @@ class ClipboardData { ...@@ -24,7 +24,6 @@ class ClipboardData {
class Clipboard { class Clipboard {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
Clipboard._(); Clipboard._();
// Constants for common [getData] [format] types. // Constants for common [getData] [format] types.
......
...@@ -12,7 +12,6 @@ import 'system_channels.dart'; ...@@ -12,7 +12,6 @@ import 'system_channels.dart';
class HapticFeedback { class HapticFeedback {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
HapticFeedback._(); HapticFeedback._();
/// Provides vibration haptic feedback to the user for a short duration. /// Provides vibration haptic feedback to the user for a short duration.
......
...@@ -11,7 +11,6 @@ import 'platform_channel.dart'; ...@@ -11,7 +11,6 @@ import 'platform_channel.dart';
class SystemChannels { class SystemChannels {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
SystemChannels._(); SystemChannels._();
/// A JSON [MethodChannel] for navigation. /// A JSON [MethodChannel] for navigation.
......
...@@ -219,7 +219,6 @@ List<String> _stringify(List<dynamic> list) => <String>[ ...@@ -219,7 +219,6 @@ List<String> _stringify(List<dynamic> list) => <String>[
class SystemChrome { class SystemChrome {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
SystemChrome._(); SystemChrome._();
/// Specifies the set of orientations the application interface can /// Specifies the set of orientations the application interface can
......
...@@ -9,7 +9,6 @@ import 'system_channels.dart'; ...@@ -9,7 +9,6 @@ import 'system_channels.dart';
class SystemNavigator { class SystemNavigator {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
SystemNavigator._(); SystemNavigator._();
/// Removes the topmost Flutter instance, presenting what was before /// Removes the topmost Flutter instance, presenting what was before
......
...@@ -29,7 +29,6 @@ enum SystemSoundType { ...@@ -29,7 +29,6 @@ enum SystemSoundType {
class SystemSound { class SystemSound {
// This class is not meant to be instantiated or extended; this constructor // This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension. // prevents instantiation and extension.
// ignore: unused_element
SystemSound._(); SystemSound._();
/// Play the specified system sound. If that sound is not present on the /// Play the specified system sound. If that sound is not present on the
......
...@@ -1745,7 +1745,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { ...@@ -1745,7 +1745,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
assert(() { assert(() {
for (int index = 0; index < children.length; index++) { for (int index = 0; index < children.length; index++) {
// TODO(a14n): remove this check to have a lot more const widget // TODO(a14n): remove this check to have a lot more const widget
if (children[index] == null) { // ignore: dead_code if (children[index] == null) {
throw FlutterError( throw FlutterError(
"$runtimeType's children must not contain any null values, " "$runtimeType's children must not contain any null values, "
'but a null value was found at index $index' 'but a null value was found at index $index'
......
...@@ -5355,13 +5355,13 @@ abstract class _RestorationInformation { ...@@ -5355,13 +5355,13 @@ abstract class _RestorationInformation {
final List<Object?> casted = data as List<Object?>; final List<Object?> casted = data as List<Object?>;
assert(casted.isNotEmpty); assert(casted.isNotEmpty);
final _RouteRestorationType type = _RouteRestorationType.values[casted[0]! as int]; final _RouteRestorationType type = _RouteRestorationType.values[casted[0]! as int];
assert(type != null);
switch (type) { switch (type) {
case _RouteRestorationType.named: case _RouteRestorationType.named:
return _NamedRestorationInformation.fromSerializableData(casted.sublist(1)); return _NamedRestorationInformation.fromSerializableData(casted.sublist(1));
case _RouteRestorationType.anonymous: case _RouteRestorationType.anonymous:
return _AnonymousRestorationInformation.fromSerializableData(casted.sublist(1)); return _AnonymousRestorationInformation.fromSerializableData(casted.sublist(1));
} }
throw StateError('Invalid type: $type'); // ignore: dead_code
} }
final _RouteRestorationType type; final _RouteRestorationType type;
......
...@@ -1278,7 +1278,7 @@ class ListView extends BoxScrollView { ...@@ -1278,7 +1278,7 @@ class ListView extends BoxScrollView {
} else { } else {
widget = separatorBuilder(context, itemIndex); widget = separatorBuilder(context, itemIndex);
assert(() { assert(() {
if (widget == null) { // ignore: dead_code if (widget == null) {
throw FlutterError('separatorBuilder cannot return null.'); throw FlutterError('separatorBuilder cannot return null.');
} }
return true; return true;
......
...@@ -793,11 +793,13 @@ void main() { ...@@ -793,11 +793,13 @@ void main() {
for (final double textScaleFactor in textScaleFactorOptions) { for (final double textScaleFactor in textScaleFactorOptions) {
for (final TextDirection textDirection in textDirectionOptions) { for (final TextDirection textDirection in textDirectionOptions) {
for (final Widget? icon in iconOptions) { for (final Widget? icon in iconOptions) {
final String testName = 'ElevatedButton' final String testName = <String>[
', text scale $textScaleFactor' // ignore: missing_whitespace_between_adjacent_strings, https://github.com/dart-lang/linter/issues/2489 'ElevatedButton, text scale $textScaleFactor',
'${icon != null ? ", with icon" : ""}' if (icon != null)
'${textDirection == TextDirection.rtl ? ", RTL" : ""}'; 'with icon',
if (textDirection == TextDirection.rtl)
'RTL',
].join(', ');
testWidgets(testName, (WidgetTester tester) async { testWidgets(testName, (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -1038,11 +1038,13 @@ void main() { ...@@ -1038,11 +1038,13 @@ void main() {
for (final double textScaleFactor in textScaleFactorOptions) { for (final double textScaleFactor in textScaleFactorOptions) {
for (final TextDirection textDirection in textDirectionOptions) { for (final TextDirection textDirection in textDirectionOptions) {
for (final Widget? icon in iconOptions) { for (final Widget? icon in iconOptions) {
final String testName = 'OutlinedButton' final String testName = <String>[
', text scale $textScaleFactor' // ignore: missing_whitespace_between_adjacent_strings, https://github.com/dart-lang/linter/issues/2489 'OutlinedButton, text scale $textScaleFactor',
'${icon != null ? ", with icon" : ""}' if (icon != null)
'${textDirection == TextDirection.rtl ? ", RTL" : ""}'; 'with icon',
if (textDirection == TextDirection.rtl)
'RTL',
].join(', ');
testWidgets(testName, (WidgetTester tester) async { testWidgets(testName, (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -831,10 +831,13 @@ void main() { ...@@ -831,10 +831,13 @@ void main() {
for (final double textScaleFactor in textScaleFactorOptions) { for (final double textScaleFactor in textScaleFactorOptions) {
for (final TextDirection textDirection in textDirectionOptions) { for (final TextDirection textDirection in textDirectionOptions) {
for (final Widget? icon in iconOptions) { for (final Widget? icon in iconOptions) {
final String testName = 'TextButton' final String testName = <String>[
', text scale $textScaleFactor' // ignore: missing_whitespace_between_adjacent_strings, https://github.com/dart-lang/linter/issues/2489 'TextButton, text scale $textScaleFactor',
'${icon != null ? ", with icon" : ""}' if (icon != null)
'${textDirection == TextDirection.rtl ? ", RTL" : ""}'; 'with icon',
if (textDirection == TextDirection.rtl)
'RTL',
].join(', ');
testWidgets(testName, (WidgetTester tester) async { testWidgets(testName, (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -427,7 +427,7 @@ void _tests() { ...@@ -427,7 +427,7 @@ void _tests() {
); );
// Ensure we preserve day period as we roll over. // Ensure we preserve day period as we roll over.
final dynamic pickerState = tester.state(_timePickerDialog); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic pickerState = tester.state(_timePickerDialog);
expect(pickerState.selectedTime, const TimeOfDay(hour: 1, minute: 0)); expect(pickerState.selectedTime, const TimeOfDay(hour: 1, minute: 0));
await actAndExpect( await actAndExpect(
...@@ -492,7 +492,7 @@ void _tests() { ...@@ -492,7 +492,7 @@ void _tests() {
); );
// Ensure we preserve hour period as we roll over. // Ensure we preserve hour period as we roll over.
final dynamic pickerState = tester.state(_timePickerDialog); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic pickerState = tester.state(_timePickerDialog);
expect(pickerState.selectedTime, const TimeOfDay(hour: 11, minute: 0)); expect(pickerState.selectedTime, const TimeOfDay(hour: 11, minute: 0));
await actAndExpect( await actAndExpect(
......
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
// Use didPopRoute() to simulate the system back button. Check that // Use didPopRoute() to simulate the system back button. Check that
// didPopRoute() indicates that the notification was handled. // didPopRoute() indicates that the notification was handled.
final dynamic widgetsAppState = tester.state(find.byType(WidgetsApp)); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic widgetsAppState = tester.state(find.byType(WidgetsApp));
expect(await widgetsAppState.didPopRoute(), isTrue); expect(await widgetsAppState.didPopRoute(), isTrue);
expect(find.text('Sample Page'), findsOneWidget); expect(find.text('Sample Page'), findsOneWidget);
......
...@@ -8,7 +8,6 @@ import 'dart:ui' as ui show Image; ...@@ -8,7 +8,6 @@ import 'dart:ui' as ui show Image;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
// ignore: must_be_immutable
class TestImageInfo implements ImageInfo { class TestImageInfo implements ImageInfo {
const TestImageInfo(this.value, { required this.image, this.scale = 1.0, this.debugLabel }); const TestImageInfo(this.value, { required this.image, this.scale = 1.0, this.debugLabel });
......
...@@ -74,7 +74,7 @@ void main() { ...@@ -74,7 +74,7 @@ void main() {
), ),
), ),
); );
final dynamic state = tester.state(find.byType(CupertinoDatePicker)); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic state = tester.state(find.byType(CupertinoDatePicker));
final Map<int, double> cache = state.estimatedColumnWidths as Map<int, double>; final Map<int, double> cache = state.estimatedColumnWidths as Map<int, double>;
expect(cache.isNotEmpty, isTrue); expect(cache.isNotEmpty, isTrue);
const Map<String, dynamic> data = <String, dynamic>{ const Map<String, dynamic> data = <String, dynamic>{
...@@ -100,7 +100,7 @@ void main() { ...@@ -100,7 +100,7 @@ void main() {
), ),
), ),
); );
final dynamic state = tester.state(find.byType(CupertinoDatePicker)); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic state = tester.state(find.byType(CupertinoDatePicker));
final Map<int, double> cache = state.estimatedColumnWidths as Map<int, double>; final Map<int, double> cache = state.estimatedColumnWidths as Map<int, double>;
// Simulates font missing. // Simulates font missing.
cache.clear(); cache.clear();
...@@ -126,7 +126,7 @@ void main() { ...@@ -126,7 +126,7 @@ void main() {
), ),
), ),
); );
final dynamic state = tester.state(find.byType(CupertinoTimerPicker)); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic state = tester.state(find.byType(CupertinoTimerPicker));
// Simulates wrong metrics due to font missing. // Simulates wrong metrics due to font missing.
state.numberLabelWidth = 0.0; state.numberLabelWidth = 0.0;
state.numberLabelHeight = 0.0; state.numberLabelHeight = 0.0;
......
...@@ -133,7 +133,7 @@ void main() { ...@@ -133,7 +133,7 @@ void main() {
test('basic structure', () async { test('basic structure', () async {
const TextInputType text = TextInputType.text; const TextInputType text = TextInputType.text;
const TextInputType number = TextInputType.number; const TextInputType number = TextInputType.number;
const TextInputType number2 = TextInputType.numberWithOptions(); // ignore: use_named_constants const TextInputType number2 = TextInputType.numberWithOptions();
const TextInputType signed = TextInputType.numberWithOptions(signed: true); const TextInputType signed = TextInputType.numberWithOptions(signed: true);
const TextInputType signed2 = TextInputType.numberWithOptions(signed: true); const TextInputType signed2 = TextInputType.numberWithOptions(signed: true);
const TextInputType decimal = TextInputType.numberWithOptions(decimal: true); const TextInputType decimal = TextInputType.numberWithOptions(decimal: true);
......
...@@ -908,7 +908,7 @@ class ButtonVariant extends TestVariant<int> { ...@@ -908,7 +908,7 @@ class ButtonVariant extends TestVariant<int> {
const ButtonVariant({ const ButtonVariant({
required this.values, required this.values,
required this.descriptions, required this.descriptions,
}) : assert(values.length != 0); // ignore: prefer_is_empty }) : assert(values.length != 0);
@override @override
final List<int> values; final List<int> values;
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
], ],
child: const Text('loaded') child: const Text('loaded')
)); ));
final dynamic state = tester.state(find.byType(Localizations)); // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic state = tester.state(find.byType(Localizations));
expect(state!.locale, isNull); expect(state!.locale, isNull);
expect(find.text('loaded'), findsNothing); expect(find.text('loaded'), findsNothing);
......
...@@ -1035,7 +1035,6 @@ void main() { ...@@ -1035,7 +1035,6 @@ void main() {
); );
// By default, clipBehavior should be Clip.hardEdge // By default, clipBehavior should be Clip.hardEdge
// ignore: unnecessary_nullable_for_final_variable_declarations
final dynamic renderObject = tester.renderObject(find.byType(Overlay)); final dynamic renderObject = tester.renderObject(find.byType(Overlay));
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge));
......
...@@ -50,7 +50,7 @@ void main() { ...@@ -50,7 +50,7 @@ void main() {
); );
// 1st, check that the render object has received the default clip behavior. // 1st, check that the render object has received the default clip behavior.
final dynamic renderObject = tester.allRenderObjects.where((RenderObject o) => o.runtimeType.toString() == '_RenderSingleChildViewport').first; // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic renderObject = tester.allRenderObjects.where((RenderObject o) => o.runtimeType.toString() == '_RenderSingleChildViewport').first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge));
// 2nd, height == widow.height test: check that the painting context does not call pushClipRect . // 2nd, height == widow.height test: check that the painting context does not call pushClipRect .
...@@ -104,7 +104,7 @@ void main() { ...@@ -104,7 +104,7 @@ void main() {
await tester.pumpWidget(SingleChildScrollView(child: Container(height: 2000.0))); await tester.pumpWidget(SingleChildScrollView(child: Container(height: 2000.0)));
// 1st, check that the render object has received the default clip behavior. // 1st, check that the render object has received the default clip behavior.
final dynamic renderObject = tester.allRenderObjects.where((RenderObject o) => o.runtimeType.toString() == '_RenderSingleChildViewport').first; // ignore: unnecessary_nullable_for_final_variable_declarations final dynamic renderObject = tester.allRenderObjects.where((RenderObject o) => o.runtimeType.toString() == '_RenderSingleChildViewport').first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge));
// 2nd, check that the painting context has received the default clip behavior. // 2nd, check that the painting context has received the default clip behavior.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment