From 9e236813fe72abf08030567c5854d47732fa883d Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 21 Dec 2023 16:30:25 +1100 Subject: [PATCH] Fixups for master CI (#2118) ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/wiki/Chat [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md --- .../shared/lib/src/models.freezed.dart | 161 ++++++++++-------- code_sharing/shared/lib/src/models.g.dart | 10 +- .../lib/pages/saved_lints_page.dart | 2 +- .../lib/widgets/lint_expansion_tile.dart | 6 +- .../lib/src/method_channel_demo.dart | 4 +- veggieseasons/lib/screens/settings.dart | 2 +- 6 files changed, 99 insertions(+), 86 deletions(-) diff --git a/code_sharing/shared/lib/src/models.freezed.dart b/code_sharing/shared/lib/src/models.freezed.dart index fe2a2e8e3..4e2d5c9a2 100644 --- a/code_sharing/shared/lib/src/models.freezed.dart +++ b/code_sharing/shared/lib/src/models.freezed.dart @@ -1,7 +1,7 @@ // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'models.dart'; @@ -31,56 +31,61 @@ mixin _$Increment { /// @nodoc abstract class $IncrementCopyWith<$Res> { factory $IncrementCopyWith(Increment value, $Res Function(Increment) then) = - _$IncrementCopyWithImpl<$Res>; + _$IncrementCopyWithImpl<$Res, Increment>; + @useResult $Res call({int by}); } /// @nodoc -class _$IncrementCopyWithImpl<$Res> implements $IncrementCopyWith<$Res> { +class _$IncrementCopyWithImpl<$Res, $Val extends Increment> + implements $IncrementCopyWith<$Res> { _$IncrementCopyWithImpl(this._value, this._then); - final Increment _value; // ignore: unused_field - final $Res Function(Increment) _then; + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + @pragma('vm:prefer-inline') @override $Res call({ - Object? by = freezed, + Object? by = null, }) { return _then(_value.copyWith( - by: by == freezed + by: null == by ? _value.by : by // ignore: cast_nullable_to_non_nullable as int, - )); + ) as $Val); } } /// @nodoc -abstract class _$$_IncrementCopyWith<$Res> implements $IncrementCopyWith<$Res> { - factory _$$_IncrementCopyWith( - _$_Increment value, $Res Function(_$_Increment) then) = - __$$_IncrementCopyWithImpl<$Res>; +abstract class _$$IncrementImplCopyWith<$Res> + implements $IncrementCopyWith<$Res> { + factory _$$IncrementImplCopyWith( + _$IncrementImpl value, $Res Function(_$IncrementImpl) then) = + __$$IncrementImplCopyWithImpl<$Res>; @override + @useResult $Res call({int by}); } /// @nodoc -class __$$_IncrementCopyWithImpl<$Res> extends _$IncrementCopyWithImpl<$Res> - implements _$$_IncrementCopyWith<$Res> { - __$$_IncrementCopyWithImpl( - _$_Increment _value, $Res Function(_$_Increment) _then) - : super(_value, (v) => _then(v as _$_Increment)); - - @override - _$_Increment get _value => super._value as _$_Increment; - +class __$$IncrementImplCopyWithImpl<$Res> + extends _$IncrementCopyWithImpl<$Res, _$IncrementImpl> + implements _$$IncrementImplCopyWith<$Res> { + __$$IncrementImplCopyWithImpl( + _$IncrementImpl _value, $Res Function(_$IncrementImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') @override $Res call({ - Object? by = freezed, + Object? by = null, }) { - return _then(_$_Increment( - by: by == freezed + return _then(_$IncrementImpl( + by: null == by ? _value.by : by // ignore: cast_nullable_to_non_nullable as int, @@ -90,11 +95,11 @@ class __$$_IncrementCopyWithImpl<$Res> extends _$IncrementCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$_Increment implements _Increment { - const _$_Increment({required this.by}); +class _$IncrementImpl implements _Increment { + const _$IncrementImpl({required this.by}); - factory _$_Increment.fromJson(Map json) => - _$$_IncrementFromJson(json); + factory _$IncrementImpl.fromJson(Map json) => + _$$IncrementImplFromJson(json); @override final int by; @@ -105,42 +110,42 @@ class _$_Increment implements _Increment { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Increment && - const DeepCollectionEquality().equals(other.by, by)); + other is _$IncrementImpl && + (identical(other.by, by) || other.by == by)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(by)); + int get hashCode => Object.hash(runtimeType, by); @JsonKey(ignore: true) @override - _$$_IncrementCopyWith<_$_Increment> get copyWith => - __$$_IncrementCopyWithImpl<_$_Increment>(this, _$identity); + @pragma('vm:prefer-inline') + _$$IncrementImplCopyWith<_$IncrementImpl> get copyWith => + __$$IncrementImplCopyWithImpl<_$IncrementImpl>(this, _$identity); @override Map toJson() { - return _$$_IncrementToJson( + return _$$IncrementImplToJson( this, ); } } abstract class _Increment implements Increment { - const factory _Increment({required final int by}) = _$_Increment; + const factory _Increment({required final int by}) = _$IncrementImpl; factory _Increment.fromJson(Map json) = - _$_Increment.fromJson; + _$IncrementImpl.fromJson; @override int get by; @override @JsonKey(ignore: true) - _$$_IncrementCopyWith<_$_Increment> get copyWith => + _$$IncrementImplCopyWith<_$IncrementImpl> get copyWith => throw _privateConstructorUsedError; } @@ -160,54 +165,60 @@ mixin _$Count { /// @nodoc abstract class $CountCopyWith<$Res> { factory $CountCopyWith(Count value, $Res Function(Count) then) = - _$CountCopyWithImpl<$Res>; + _$CountCopyWithImpl<$Res, Count>; + @useResult $Res call({int value}); } /// @nodoc -class _$CountCopyWithImpl<$Res> implements $CountCopyWith<$Res> { +class _$CountCopyWithImpl<$Res, $Val extends Count> + implements $CountCopyWith<$Res> { _$CountCopyWithImpl(this._value, this._then); - final Count _value; // ignore: unused_field - final $Res Function(Count) _then; + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + @pragma('vm:prefer-inline') @override $Res call({ - Object? value = freezed, + Object? value = null, }) { return _then(_value.copyWith( - value: value == freezed + value: null == value ? _value.value : value // ignore: cast_nullable_to_non_nullable as int, - )); + ) as $Val); } } /// @nodoc -abstract class _$$_CountCopyWith<$Res> implements $CountCopyWith<$Res> { - factory _$$_CountCopyWith(_$_Count value, $Res Function(_$_Count) then) = - __$$_CountCopyWithImpl<$Res>; +abstract class _$$CountImplCopyWith<$Res> implements $CountCopyWith<$Res> { + factory _$$CountImplCopyWith( + _$CountImpl value, $Res Function(_$CountImpl) then) = + __$$CountImplCopyWithImpl<$Res>; @override + @useResult $Res call({int value}); } /// @nodoc -class __$$_CountCopyWithImpl<$Res> extends _$CountCopyWithImpl<$Res> - implements _$$_CountCopyWith<$Res> { - __$$_CountCopyWithImpl(_$_Count _value, $Res Function(_$_Count) _then) - : super(_value, (v) => _then(v as _$_Count)); - - @override - _$_Count get _value => super._value as _$_Count; - +class __$$CountImplCopyWithImpl<$Res> + extends _$CountCopyWithImpl<$Res, _$CountImpl> + implements _$$CountImplCopyWith<$Res> { + __$$CountImplCopyWithImpl( + _$CountImpl _value, $Res Function(_$CountImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') @override $Res call({ - Object? value = freezed, + Object? value = null, }) { - return _then(_$_Count( - value == freezed + return _then(_$CountImpl( + null == value ? _value.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -217,11 +228,11 @@ class __$$_CountCopyWithImpl<$Res> extends _$CountCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$_Count implements _Count { - const _$_Count(this.value); +class _$CountImpl implements _Count { + const _$CountImpl(this.value); - factory _$_Count.fromJson(Map json) => - _$$_CountFromJson(json); + factory _$CountImpl.fromJson(Map json) => + _$$CountImplFromJson(json); @override final int value; @@ -232,40 +243,40 @@ class _$_Count implements _Count { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Count && - const DeepCollectionEquality().equals(other.value, value)); + other is _$CountImpl && + (identical(other.value, value) || other.value == value)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(value)); + int get hashCode => Object.hash(runtimeType, value); @JsonKey(ignore: true) @override - _$$_CountCopyWith<_$_Count> get copyWith => - __$$_CountCopyWithImpl<_$_Count>(this, _$identity); + @pragma('vm:prefer-inline') + _$$CountImplCopyWith<_$CountImpl> get copyWith => + __$$CountImplCopyWithImpl<_$CountImpl>(this, _$identity); @override Map toJson() { - return _$$_CountToJson( + return _$$CountImplToJson( this, ); } } abstract class _Count implements Count { - const factory _Count(final int value) = _$_Count; + const factory _Count(final int value) = _$CountImpl; - factory _Count.fromJson(Map json) = _$_Count.fromJson; + factory _Count.fromJson(Map json) = _$CountImpl.fromJson; @override int get value; @override @JsonKey(ignore: true) - _$$_CountCopyWith<_$_Count> get copyWith => + _$$CountImplCopyWith<_$CountImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/code_sharing/shared/lib/src/models.g.dart b/code_sharing/shared/lib/src/models.g.dart index ad3ee04e4..81d648df6 100644 --- a/code_sharing/shared/lib/src/models.g.dart +++ b/code_sharing/shared/lib/src/models.g.dart @@ -6,19 +6,21 @@ part of 'models.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_Increment _$$_IncrementFromJson(Map json) => _$_Increment( +_$IncrementImpl _$$IncrementImplFromJson(Map json) => + _$IncrementImpl( by: json['by'] as int, ); -Map _$$_IncrementToJson(_$_Increment instance) => +Map _$$IncrementImplToJson(_$IncrementImpl instance) => { 'by': instance.by, }; -_$_Count _$$_CountFromJson(Map json) => _$_Count( +_$CountImpl _$$CountImplFromJson(Map json) => _$CountImpl( json['value'] as int, ); -Map _$$_CountToJson(_$_Count instance) => { +Map _$$CountImplToJson(_$CountImpl instance) => + { 'value': instance.value, }; diff --git a/experimental/linting_tool/lib/pages/saved_lints_page.dart b/experimental/linting_tool/lib/pages/saved_lints_page.dart index 2d88bf15c..d7f2639a3 100644 --- a/experimental/linting_tool/lib/pages/saved_lints_page.dart +++ b/experimental/linting_tool/lib/pages/saved_lints_page.dart @@ -101,7 +101,7 @@ class _SavedLintsPageState extends State { var saved = await profilesStore .exportProfileFile(profile); - if (!mounted) return; + if (!context.mounted) return; if (!saved) { _showSnackBar( diff --git a/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart b/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart index 8e476f998..0663203ad 100644 --- a/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart +++ b/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart @@ -140,7 +140,7 @@ class _LintExpansionTileState extends State { return const _ProfileTypeDialog(); }, ); - if (!mounted) return; + if (!context.mounted) return; if (destinationProfileType == ProfileType.newProfile) { await showDialog( context: context, @@ -264,7 +264,7 @@ class _NewProfileDialogState extends State { ); await Provider.of(context, listen: false) .addToNewProfile(newProfile); - if (!mounted) return; + if (!context.mounted) return; Navigator.pop(context); } }, @@ -304,7 +304,7 @@ class _ExistingProfileDialogState extends State { onTap: () async { await profilesStore.addToExistingProfile( savedProfiles[index], widget.rule); - if (!mounted) return; + if (!context.mounted) return; Navigator.pop(context); }, ), diff --git a/platform_channels/lib/src/method_channel_demo.dart b/platform_channels/lib/src/method_channel_demo.dart index f4810c61e..396afd188 100644 --- a/platform_channels/lib/src/method_channel_demo.dart +++ b/platform_channels/lib/src/method_channel_demo.dart @@ -46,7 +46,7 @@ class _MethodChannelDemoState extends State { final value = await Counter.increment(counterValue: count); setState(() => count = value); } catch (error) { - if (!mounted) return; + if (!context.mounted) return; showErrorMessage( context, (error as PlatformException).message!, @@ -65,7 +65,7 @@ class _MethodChannelDemoState extends State { final value = await Counter.decrement(counterValue: count); setState(() => count = value); } catch (error) { - if (!mounted) return; + if (!context.mounted) return; showErrorMessage( context, (error as PlatformException).message!, diff --git a/veggieseasons/lib/screens/settings.dart b/veggieseasons/lib/screens/settings.dart index a095695da..7e5a872fd 100644 --- a/veggieseasons/lib/screens/settings.dart +++ b/veggieseasons/lib/screens/settings.dart @@ -234,7 +234,7 @@ class _SettingsScreenState extends State { child: const Text('Yes'), onPressed: () async { await prefs.restoreDefaults(); - if (!mounted) return; + if (!context.mounted) return; context.pop(); }, ),