diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/eval.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/eval.dart index 1d81fff2cc5..862addab88a 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/eval.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/eval.dart @@ -4,8 +4,6 @@ /// A few utilities related to evaluating dart code -// @dart=2.9 - library eval; import 'package:flutter/foundation.dart'; @@ -21,7 +19,7 @@ import '../../../shared/globals.dart'; /// this ensures that providers reload properly when the devtool is connected /// to a different application. final serviceProvider = StreamProvider((ref) async* { - yield serviceManager.service; + yield serviceManager.service!; yield* serviceManager.onConnectionAvailable; }); @@ -38,7 +36,7 @@ final providerEvalProvider = /// An [EvalOnDartLibrary] for custom objects. final libraryEvalProvider = FutureProviderFamily((ref, libraryPath) async { - final service = await ref.watch(serviceProvider.last); + final service = await ref.watch(serviceProvider.future); final eval = EvalOnDartLibrary(libraryPath, service); ref.onDispose(eval.dispose); @@ -46,6 +44,18 @@ final libraryEvalProvider = }); final hotRestartEventProvider = - ChangeNotifierProvider>((ref) { - return serviceManager.isolateManager.selectedIsolate; + ChangeNotifierProvider>((ref) { + final selectedIsolateListenable = + serviceManager.isolateManager.selectedIsolate; + + // Since ChangeNotifierProvider calls `dispose` on the returned ChangeNotifier + // when the provider is destroyed, we can't simply return `selectedIsolateListenable`. + // So we're making a copy of it instead. + final notifier = ValueNotifier(selectedIsolateListenable.value); + + void listener() => notifier.value = selectedIsolateListenable.value; + selectedIsolateListenable.addListener(listener); + ref.onDispose(() => selectedIsolateListenable.removeListener(listener)); + + return notifier; }); diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/fake_freezed_annotation.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/fake_freezed_annotation.dart index 8dd3b5762ad..e27aa470a0d 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/fake_freezed_annotation.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/fake_freezed_annotation.dart @@ -7,8 +7,6 @@ // We could instead remove the annotations, but that would make the process of // updating the generated files tedious. -// @dart=2.9 - const nullable = Object(); const freezed = Object(); @@ -22,7 +20,7 @@ class Assert { class JsonKey { const JsonKey({ - bool ignore, - Object defaultValue, + bool? ignore, + Object? defaultValue, }); } diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.dart index 9f5fec35553..8c294feccbd 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; import 'package:vm_service/vm_service.dart'; @@ -22,12 +20,12 @@ part 'instance_details.freezed.dart'; typedef Setter = Future Function(String newValue); @freezed -abstract class PathToProperty with _$PathToProperty { +class PathToProperty with _$PathToProperty { const factory PathToProperty.listIndex(int index) = ListIndexPath; // TODO test that mutating a Map does not collapse previously expanded keys const factory PathToProperty.mapKey({ - @required @nullable String ref, + required String? ref, }) = MapKeyPath; /// Must not depend on [InstanceRef] and its ID, as they may change across @@ -39,13 +37,13 @@ abstract class PathToProperty with _$PathToProperty { /// an object can have multiple properties with the same name (private properties /// defined in different libraries) const factory PathToProperty.objectProperty({ - @required String name, + required String name, /// Path to the class/mixin that defined this property - @required String ownerUri, + required String ownerUri, /// Name of the class/mixin that defined this property - @required String ownerName, + required String ownerName, }) = PropertyPath; factory PathToProperty.fromObjectField(ObjectField field) { @@ -58,21 +56,21 @@ abstract class PathToProperty with _$PathToProperty { } @freezed -abstract class ObjectField with _$ObjectField { +class ObjectField with _$ObjectField { factory ObjectField({ - @required String name, - @required bool isFinal, - @required String ownerName, - @required String ownerUri, - @required @nullable Result ref, + required String name, + required bool isFinal, + required String ownerName, + required String ownerUri, + required Result ref, /// An [EvalOnDartLibrary] that can access this field from the owner object - @required EvalOnDartLibrary eval, + required EvalOnDartLibrary eval, /// Whether this field was defined by the inspected app or by one of its dependencies /// /// This is used by the UI to hide variables that are not useful for the user. - @required bool isDefinedByDependency, + required bool isDefinedByDependency, }) = _ObjectField; ObjectField._(); @@ -81,65 +79,63 @@ abstract class ObjectField with _$ObjectField { } @freezed -abstract class InstanceDetails with _$InstanceDetails { +class InstanceDetails with _$InstanceDetails { InstanceDetails._(); - @Assert('instanceRefId == null') factory InstanceDetails.nill({ - String instanceRefId, - @required @nullable Setter setter, + required Setter? setter, }) = NullInstance; factory InstanceDetails.boolean( String displayString, { - @required String instanceRefId, - @required @nullable Setter setter, + required String instanceRefId, + required Setter? setter, }) = BoolInstance; factory InstanceDetails.number( String displayString, { - @required String instanceRefId, - @required @nullable Setter setter, + required String instanceRefId, + required Setter? setter, }) = NumInstance; factory InstanceDetails.string( String displayString, { - @required String instanceRefId, - @required @nullable Setter setter, + required String instanceRefId, + required Setter? setter, }) = StringInstance; factory InstanceDetails.map( List keys, { - @required int hash, - @required String instanceRefId, - @required @nullable Setter setter, + required int hash, + required String instanceRefId, + required Setter? setter, }) = MapInstance; factory InstanceDetails.list({ - @required @nullable int length, - @required int hash, - @required String instanceRefId, - @required @nullable Setter setter, + required int length, + required int hash, + required String instanceRefId, + required Setter? setter, }) = ListInstance; factory InstanceDetails.object( List fields, { - @required String type, - @required int hash, - @required String instanceRefId, - @required @nullable Setter setter, + required String type, + required int hash, + required String instanceRefId, + required Setter? setter, /// An [EvalOnDartLibrary] associated with the library of this object /// /// This allows to edit private properties. - @required EvalOnDartLibrary evalForInstance, + required EvalOnDartLibrary evalForInstance, }) = ObjectInstance; factory InstanceDetails.enumeration({ - @required String type, - @required String value, - @required @nullable Setter setter, - @required String instanceRefId, + required String type, + required String value, + required Setter? setter, + required String instanceRefId, }) = EnumInstance; bool get isExpandable { @@ -156,15 +152,29 @@ abstract class InstanceDetails with _$InstanceDetails { object: (instance) => instance.fields.isNotEmpty, ); } + + // Since `nil` doesn't have those properties, we are manually exposing them + String? get instanceRefId { + return map( + nill: (_) => null, + boolean: (a) => a.instanceRefId, + number: (a) => a.instanceRefId, + string: (a) => a.instanceRefId, + map: (a) => a.instanceRefId, + list: (a) => a.instanceRefId, + object: (a) => a.instanceRefId, + enumeration: (a) => a.instanceRefId, + ); + } } /// The path to visit child elements of an [Instance] or providers from `provider`/`riverpod`. @freezed -abstract class InstancePath with _$InstancePath { +class InstancePath with _$InstancePath { const InstancePath._(); const factory InstancePath.fromInstanceId( - @nullable String instanceId, { + String instanceId, { @Default([]) List pathToProperty, }) = _InstancePathFromInstanceId; @@ -175,7 +185,7 @@ abstract class InstancePath with _$InstancePath { InstancePath get root => copyWith(pathToProperty: []); - InstancePath get parent { + InstancePath? get parent { if (pathToProperty.isEmpty) return null; return copyWith( diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.freezed.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.freezed.dart index 654c91b2ae4..e28024d16bc 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.freezed.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.freezed.dart @@ -1,11 +1,6 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - +// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: 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 - -// @dart=2.9 +// 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 part of 'instance_details.dart'; @@ -15,29 +10,29 @@ part of 'instance_details.dart'; T _$identity(T value) => value; +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + /// @nodoc class _$PathToPropertyTearOff { const _$PathToPropertyTearOff(); -// ignore: unused_element ListIndexPath listIndex(int index) { return ListIndexPath( index, ); } -// ignore: unused_element - MapKeyPath mapKey({@required @nullable String ref}) { + MapKeyPath mapKey({required String? ref}) { return MapKeyPath( ref: ref, ); } -// ignore: unused_element PropertyPath objectProperty( - {@required String name, - @required String ownerUri, - @required String ownerName}) { + {required String name, + required String ownerUri, + required String ownerName}) { return PropertyPath( name: name, ownerUri: ownerUri, @@ -47,38 +42,57 @@ class _$PathToPropertyTearOff { } /// @nodoc -// ignore: unused_element const $PathToProperty = _$PathToPropertyTearOff(); /// @nodoc mixin _$PathToProperty { @optionalTypeArgs - TResult when({ - @required TResult listIndex(int index), - @required TResult mapKey(@nullable String ref), - @required - TResult objectProperty(String name, String ownerUri, String ownerName), - }); - @optionalTypeArgs - TResult maybeWhen({ - TResult listIndex(int index), - TResult mapKey(@nullable String ref), - TResult objectProperty(String name, String ownerUri, String ownerName), - @required TResult orElse(), - }); - @optionalTypeArgs - TResult map({ - @required TResult listIndex(ListIndexPath value), - @required TResult mapKey(MapKeyPath value), - @required TResult objectProperty(PropertyPath value), - }); - @optionalTypeArgs - TResult maybeMap({ - TResult listIndex(ListIndexPath value), - TResult mapKey(MapKeyPath value), - TResult objectProperty(PropertyPath value), - @required TResult orElse(), - }); + TResult when({ + required TResult Function(int index) listIndex, + required TResult Function(String? ref) mapKey, + required TResult Function(String name, String ownerUri, String ownerName) + objectProperty, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ListIndexPath value) listIndex, + required TResult Function(MapKeyPath value) mapKey, + required TResult Function(PropertyPath value) objectProperty, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; } /// @nodoc @@ -119,37 +133,49 @@ class _$ListIndexPathCopyWithImpl<$Res> @override $Res call({ - Object index = freezed, + Object? index = freezed, }) { return _then(ListIndexPath( - index == freezed ? _value.index : index as int, + index == freezed + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int, )); } } /// @nodoc -class _$ListIndexPath implements ListIndexPath { - const _$ListIndexPath(this.index) : assert(index != null); + +class _$ListIndexPath with DiagnosticableTreeMixin implements ListIndexPath { + const _$ListIndexPath(this.index); @override final int index; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'PathToProperty.listIndex(index: $index)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'PathToProperty.listIndex')) + ..add(DiagnosticsProperty('index', index)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is ListIndexPath && - (identical(other.index, index) || - const DeepCollectionEquality().equals(other.index, index))); + (other.runtimeType == runtimeType && + other is ListIndexPath && + const DeepCollectionEquality().equals(other.index, index)); } @override int get hashCode => - runtimeType.hashCode ^ const DeepCollectionEquality().hash(index); + Object.hash(runtimeType, const DeepCollectionEquality().hash(index)); @JsonKey(ignore: true) @override @@ -158,27 +184,35 @@ class _$ListIndexPath implements ListIndexPath { @override @optionalTypeArgs - TResult when({ - @required TResult listIndex(int index), - @required TResult mapKey(@nullable String ref), - @required - TResult objectProperty(String name, String ownerUri, String ownerName), + TResult when({ + required TResult Function(int index) listIndex, + required TResult Function(String? ref) mapKey, + required TResult Function(String name, String ownerUri, String ownerName) + objectProperty, }) { - assert(listIndex != null); - assert(mapKey != null); - assert(objectProperty != null); return listIndex(index); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult listIndex(int index), - TResult mapKey(@nullable String ref), - TResult objectProperty(String name, String ownerUri, String ownerName), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + }) { + return listIndex?.call(index); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + required TResult orElse(), }) { - assert(orElse != null); if (listIndex != null) { return listIndex(index); } @@ -187,26 +221,32 @@ class _$ListIndexPath implements ListIndexPath { @override @optionalTypeArgs - TResult map({ - @required TResult listIndex(ListIndexPath value), - @required TResult mapKey(MapKeyPath value), - @required TResult objectProperty(PropertyPath value), + TResult map({ + required TResult Function(ListIndexPath value) listIndex, + required TResult Function(MapKeyPath value) mapKey, + required TResult Function(PropertyPath value) objectProperty, }) { - assert(listIndex != null); - assert(mapKey != null); - assert(objectProperty != null); return listIndex(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult listIndex(ListIndexPath value), - TResult mapKey(MapKeyPath value), - TResult objectProperty(PropertyPath value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + }) { + return listIndex?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + required TResult orElse(), }) { - assert(orElse != null); if (listIndex != null) { return listIndex(this); } @@ -219,7 +259,8 @@ abstract class ListIndexPath implements PathToProperty { int get index; @JsonKey(ignore: true) - $ListIndexPathCopyWith get copyWith; + $ListIndexPathCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -227,7 +268,7 @@ abstract class $MapKeyPathCopyWith<$Res> { factory $MapKeyPathCopyWith( MapKeyPath value, $Res Function(MapKeyPath) then) = _$MapKeyPathCopyWithImpl<$Res>; - $Res call({@nullable String ref}); + $Res call({String? ref}); } /// @nodoc @@ -241,38 +282,49 @@ class _$MapKeyPathCopyWithImpl<$Res> extends _$PathToPropertyCopyWithImpl<$Res> @override $Res call({ - Object ref = freezed, + Object? ref = freezed, }) { return _then(MapKeyPath( - ref: ref == freezed ? _value.ref : ref as String, + ref: ref == freezed + ? _value.ref + : ref // ignore: cast_nullable_to_non_nullable + as String?, )); } } /// @nodoc -class _$MapKeyPath implements MapKeyPath { - const _$MapKeyPath({@required @nullable this.ref}); + +class _$MapKeyPath with DiagnosticableTreeMixin implements MapKeyPath { + const _$MapKeyPath({required this.ref}); @override - @nullable - final String ref; + final String? ref; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'PathToProperty.mapKey(ref: $ref)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'PathToProperty.mapKey')) + ..add(DiagnosticsProperty('ref', ref)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is MapKeyPath && - (identical(other.ref, ref) || - const DeepCollectionEquality().equals(other.ref, ref))); + (other.runtimeType == runtimeType && + other is MapKeyPath && + const DeepCollectionEquality().equals(other.ref, ref)); } @override int get hashCode => - runtimeType.hashCode ^ const DeepCollectionEquality().hash(ref); + Object.hash(runtimeType, const DeepCollectionEquality().hash(ref)); @JsonKey(ignore: true) @override @@ -281,27 +333,35 @@ class _$MapKeyPath implements MapKeyPath { @override @optionalTypeArgs - TResult when({ - @required TResult listIndex(int index), - @required TResult mapKey(@nullable String ref), - @required - TResult objectProperty(String name, String ownerUri, String ownerName), + TResult when({ + required TResult Function(int index) listIndex, + required TResult Function(String? ref) mapKey, + required TResult Function(String name, String ownerUri, String ownerName) + objectProperty, }) { - assert(listIndex != null); - assert(mapKey != null); - assert(objectProperty != null); return mapKey(ref); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult listIndex(int index), - TResult mapKey(@nullable String ref), - TResult objectProperty(String name, String ownerUri, String ownerName), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + }) { + return mapKey?.call(ref); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + required TResult orElse(), }) { - assert(orElse != null); if (mapKey != null) { return mapKey(ref); } @@ -310,26 +370,32 @@ class _$MapKeyPath implements MapKeyPath { @override @optionalTypeArgs - TResult map({ - @required TResult listIndex(ListIndexPath value), - @required TResult mapKey(MapKeyPath value), - @required TResult objectProperty(PropertyPath value), + TResult map({ + required TResult Function(ListIndexPath value) listIndex, + required TResult Function(MapKeyPath value) mapKey, + required TResult Function(PropertyPath value) objectProperty, }) { - assert(listIndex != null); - assert(mapKey != null); - assert(objectProperty != null); return mapKey(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult listIndex(ListIndexPath value), - TResult mapKey(MapKeyPath value), - TResult objectProperty(PropertyPath value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + }) { + return mapKey?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + required TResult orElse(), }) { - assert(orElse != null); if (mapKey != null) { return mapKey(this); } @@ -338,12 +404,12 @@ class _$MapKeyPath implements MapKeyPath { } abstract class MapKeyPath implements PathToProperty { - const factory MapKeyPath({@required @nullable String ref}) = _$MapKeyPath; + const factory MapKeyPath({required String? ref}) = _$MapKeyPath; - @nullable - String get ref; + String? get ref; @JsonKey(ignore: true) - $MapKeyPathCopyWith get copyWith; + $MapKeyPathCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -367,25 +433,32 @@ class _$PropertyPathCopyWithImpl<$Res> @override $Res call({ - Object name = freezed, - Object ownerUri = freezed, - Object ownerName = freezed, + Object? name = freezed, + Object? ownerUri = freezed, + Object? ownerName = freezed, }) { return _then(PropertyPath( - name: name == freezed ? _value.name : name as String, - ownerUri: ownerUri == freezed ? _value.ownerUri : ownerUri as String, - ownerName: ownerName == freezed ? _value.ownerName : ownerName as String, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + ownerUri: ownerUri == freezed + ? _value.ownerUri + : ownerUri // ignore: cast_nullable_to_non_nullable + as String, + ownerName: ownerName == freezed + ? _value.ownerName + : ownerName // ignore: cast_nullable_to_non_nullable + as String, )); } } /// @nodoc -class _$PropertyPath implements PropertyPath { + +class _$PropertyPath with DiagnosticableTreeMixin implements PropertyPath { const _$PropertyPath( - {@required this.name, @required this.ownerUri, @required this.ownerName}) - : assert(name != null), - assert(ownerUri != null), - assert(ownerName != null); + {required this.name, required this.ownerUri, required this.ownerName}); @override final String name; @@ -399,30 +472,36 @@ class _$PropertyPath implements PropertyPath { final String ownerName; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'PathToProperty.objectProperty(name: $name, ownerUri: $ownerUri, ownerName: $ownerName)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'PathToProperty.objectProperty')) + ..add(DiagnosticsProperty('name', name)) + ..add(DiagnosticsProperty('ownerUri', ownerUri)) + ..add(DiagnosticsProperty('ownerName', ownerName)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is PropertyPath && - (identical(other.name, name) || - const DeepCollectionEquality().equals(other.name, name)) && - (identical(other.ownerUri, ownerUri) || - const DeepCollectionEquality() - .equals(other.ownerUri, ownerUri)) && - (identical(other.ownerName, ownerName) || - const DeepCollectionEquality() - .equals(other.ownerName, ownerName))); + (other.runtimeType == runtimeType && + other is PropertyPath && + const DeepCollectionEquality().equals(other.name, name) && + const DeepCollectionEquality().equals(other.ownerUri, ownerUri) && + const DeepCollectionEquality().equals(other.ownerName, ownerName)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(name) ^ - const DeepCollectionEquality().hash(ownerUri) ^ - const DeepCollectionEquality().hash(ownerName); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(name), + const DeepCollectionEquality().hash(ownerUri), + const DeepCollectionEquality().hash(ownerName)); @JsonKey(ignore: true) @override @@ -431,27 +510,35 @@ class _$PropertyPath implements PropertyPath { @override @optionalTypeArgs - TResult when({ - @required TResult listIndex(int index), - @required TResult mapKey(@nullable String ref), - @required - TResult objectProperty(String name, String ownerUri, String ownerName), + TResult when({ + required TResult Function(int index) listIndex, + required TResult Function(String? ref) mapKey, + required TResult Function(String name, String ownerUri, String ownerName) + objectProperty, }) { - assert(listIndex != null); - assert(mapKey != null); - assert(objectProperty != null); return objectProperty(name, ownerUri, ownerName); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult listIndex(int index), - TResult mapKey(@nullable String ref), - TResult objectProperty(String name, String ownerUri, String ownerName), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + }) { + return objectProperty?.call(name, ownerUri, ownerName); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int index)? listIndex, + TResult Function(String? ref)? mapKey, + TResult Function(String name, String ownerUri, String ownerName)? + objectProperty, + required TResult orElse(), }) { - assert(orElse != null); if (objectProperty != null) { return objectProperty(name, ownerUri, ownerName); } @@ -460,26 +547,32 @@ class _$PropertyPath implements PropertyPath { @override @optionalTypeArgs - TResult map({ - @required TResult listIndex(ListIndexPath value), - @required TResult mapKey(MapKeyPath value), - @required TResult objectProperty(PropertyPath value), + TResult map({ + required TResult Function(ListIndexPath value) listIndex, + required TResult Function(MapKeyPath value) mapKey, + required TResult Function(PropertyPath value) objectProperty, }) { - assert(listIndex != null); - assert(mapKey != null); - assert(objectProperty != null); return objectProperty(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult listIndex(ListIndexPath value), - TResult mapKey(MapKeyPath value), - TResult objectProperty(PropertyPath value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + }) { + return objectProperty?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ListIndexPath value)? listIndex, + TResult Function(MapKeyPath value)? mapKey, + TResult Function(PropertyPath value)? objectProperty, + required TResult orElse(), }) { - assert(orElse != null); if (objectProperty != null) { return objectProperty(this); } @@ -489,9 +582,9 @@ class _$PropertyPath implements PropertyPath { abstract class PropertyPath implements PathToProperty { const factory PropertyPath( - {@required String name, - @required String ownerUri, - @required String ownerName}) = _$PropertyPath; + {required String name, + required String ownerUri, + required String ownerName}) = _$PropertyPath; String get name; @@ -501,22 +594,22 @@ abstract class PropertyPath implements PathToProperty { /// Name of the class/mixin that defined this property String get ownerName; @JsonKey(ignore: true) - $PropertyPathCopyWith get copyWith; + $PropertyPathCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc class _$ObjectFieldTearOff { const _$ObjectFieldTearOff(); -// ignore: unused_element _ObjectField call( - {@required String name, - @required bool isFinal, - @required String ownerName, - @required String ownerUri, - @required @nullable Result ref, - @required EvalOnDartLibrary eval, - @required bool isDefinedByDependency}) { + {required String name, + required bool isFinal, + required String ownerName, + required String ownerUri, + required Result ref, + required EvalOnDartLibrary eval, + required bool isDefinedByDependency}) { return _ObjectField( name: name, isFinal: isFinal, @@ -530,28 +623,27 @@ class _$ObjectFieldTearOff { } /// @nodoc -// ignore: unused_element const $ObjectField = _$ObjectFieldTearOff(); /// @nodoc mixin _$ObjectField { - String get name; - bool get isFinal; - String get ownerName; - String get ownerUri; - @nullable - Result get ref; + String get name => throw _privateConstructorUsedError; + bool get isFinal => throw _privateConstructorUsedError; + String get ownerName => throw _privateConstructorUsedError; + String get ownerUri => throw _privateConstructorUsedError; + Result get ref => throw _privateConstructorUsedError; /// An [EvalOnDartLibrary] that can access this field from the owner object - EvalOnDartLibrary get eval; + EvalOnDartLibrary get eval => throw _privateConstructorUsedError; /// Whether this field was defined by the inspected app or by one of its dependencies /// /// This is used by the UI to hide variables that are not useful for the user. - bool get isDefinedByDependency; + bool get isDefinedByDependency => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ObjectFieldCopyWith get copyWith; + $ObjectFieldCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -564,7 +656,7 @@ abstract class $ObjectFieldCopyWith<$Res> { bool isFinal, String ownerName, String ownerUri, - @nullable Result ref, + Result ref, EvalOnDartLibrary eval, bool isDefinedByDependency}); @@ -581,32 +673,48 @@ class _$ObjectFieldCopyWithImpl<$Res> implements $ObjectFieldCopyWith<$Res> { @override $Res call({ - Object name = freezed, - Object isFinal = freezed, - Object ownerName = freezed, - Object ownerUri = freezed, - Object ref = freezed, - Object eval = freezed, - Object isDefinedByDependency = freezed, + Object? name = freezed, + Object? isFinal = freezed, + Object? ownerName = freezed, + Object? ownerUri = freezed, + Object? ref = freezed, + Object? eval = freezed, + Object? isDefinedByDependency = freezed, }) { return _then(_value.copyWith( - name: name == freezed ? _value.name : name as String, - isFinal: isFinal == freezed ? _value.isFinal : isFinal as bool, - ownerName: ownerName == freezed ? _value.ownerName : ownerName as String, - ownerUri: ownerUri == freezed ? _value.ownerUri : ownerUri as String, - ref: ref == freezed ? _value.ref : ref as Result, - eval: eval == freezed ? _value.eval : eval as EvalOnDartLibrary, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + isFinal: isFinal == freezed + ? _value.isFinal + : isFinal // ignore: cast_nullable_to_non_nullable + as bool, + ownerName: ownerName == freezed + ? _value.ownerName + : ownerName // ignore: cast_nullable_to_non_nullable + as String, + ownerUri: ownerUri == freezed + ? _value.ownerUri + : ownerUri // ignore: cast_nullable_to_non_nullable + as String, + ref: ref == freezed + ? _value.ref + : ref // ignore: cast_nullable_to_non_nullable + as Result, + eval: eval == freezed + ? _value.eval + : eval // ignore: cast_nullable_to_non_nullable + as EvalOnDartLibrary, isDefinedByDependency: isDefinedByDependency == freezed ? _value.isDefinedByDependency - : isDefinedByDependency as bool, + : isDefinedByDependency // ignore: cast_nullable_to_non_nullable + as bool, )); } @override $ResultCopyWith get ref { - if (_value.ref == null) { - return null; - } return $ResultCopyWith(_value.ref, (value) { return _then(_value.copyWith(ref: value)); }); @@ -625,7 +733,7 @@ abstract class _$ObjectFieldCopyWith<$Res> bool isFinal, String ownerName, String ownerUri, - @nullable Result ref, + Result ref, EvalOnDartLibrary eval, bool isDefinedByDependency}); @@ -645,45 +753,59 @@ class __$ObjectFieldCopyWithImpl<$Res> extends _$ObjectFieldCopyWithImpl<$Res> @override $Res call({ - Object name = freezed, - Object isFinal = freezed, - Object ownerName = freezed, - Object ownerUri = freezed, - Object ref = freezed, - Object eval = freezed, - Object isDefinedByDependency = freezed, + Object? name = freezed, + Object? isFinal = freezed, + Object? ownerName = freezed, + Object? ownerUri = freezed, + Object? ref = freezed, + Object? eval = freezed, + Object? isDefinedByDependency = freezed, }) { return _then(_ObjectField( - name: name == freezed ? _value.name : name as String, - isFinal: isFinal == freezed ? _value.isFinal : isFinal as bool, - ownerName: ownerName == freezed ? _value.ownerName : ownerName as String, - ownerUri: ownerUri == freezed ? _value.ownerUri : ownerUri as String, - ref: ref == freezed ? _value.ref : ref as Result, - eval: eval == freezed ? _value.eval : eval as EvalOnDartLibrary, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + isFinal: isFinal == freezed + ? _value.isFinal + : isFinal // ignore: cast_nullable_to_non_nullable + as bool, + ownerName: ownerName == freezed + ? _value.ownerName + : ownerName // ignore: cast_nullable_to_non_nullable + as String, + ownerUri: ownerUri == freezed + ? _value.ownerUri + : ownerUri // ignore: cast_nullable_to_non_nullable + as String, + ref: ref == freezed + ? _value.ref + : ref // ignore: cast_nullable_to_non_nullable + as Result, + eval: eval == freezed + ? _value.eval + : eval // ignore: cast_nullable_to_non_nullable + as EvalOnDartLibrary, isDefinedByDependency: isDefinedByDependency == freezed ? _value.isDefinedByDependency - : isDefinedByDependency as bool, + : isDefinedByDependency // ignore: cast_nullable_to_non_nullable + as bool, )); } } /// @nodoc -class _$_ObjectField extends _ObjectField { + +class _$_ObjectField extends _ObjectField with DiagnosticableTreeMixin { _$_ObjectField( - {@required this.name, - @required this.isFinal, - @required this.ownerName, - @required this.ownerUri, - @required @nullable this.ref, - @required this.eval, - @required this.isDefinedByDependency}) - : assert(name != null), - assert(isFinal != null), - assert(ownerName != null), - assert(ownerUri != null), - assert(eval != null), - assert(isDefinedByDependency != null), - super._(); + {required this.name, + required this.isFinal, + required this.ownerName, + required this.ownerUri, + required this.ref, + required this.eval, + required this.isDefinedByDependency}) + : super._(); @override final String name; @@ -694,7 +816,6 @@ class _$_ObjectField extends _ObjectField { @override final String ownerUri; @override - @nullable final Result ref; @override @@ -708,44 +829,50 @@ class _$_ObjectField extends _ObjectField { final bool isDefinedByDependency; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'ObjectField(name: $name, isFinal: $isFinal, ownerName: $ownerName, ownerUri: $ownerUri, ref: $ref, eval: $eval, isDefinedByDependency: $isDefinedByDependency)'; } @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other is _ObjectField && - (identical(other.name, name) || - const DeepCollectionEquality().equals(other.name, name)) && - (identical(other.isFinal, isFinal) || - const DeepCollectionEquality() - .equals(other.isFinal, isFinal)) && - (identical(other.ownerName, ownerName) || - const DeepCollectionEquality() - .equals(other.ownerName, ownerName)) && - (identical(other.ownerUri, ownerUri) || - const DeepCollectionEquality() - .equals(other.ownerUri, ownerUri)) && - (identical(other.ref, ref) || - const DeepCollectionEquality().equals(other.ref, ref)) && - (identical(other.eval, eval) || - const DeepCollectionEquality().equals(other.eval, eval)) && - (identical(other.isDefinedByDependency, isDefinedByDependency) || - const DeepCollectionEquality().equals( - other.isDefinedByDependency, isDefinedByDependency))); + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'ObjectField')) + ..add(DiagnosticsProperty('name', name)) + ..add(DiagnosticsProperty('isFinal', isFinal)) + ..add(DiagnosticsProperty('ownerName', ownerName)) + ..add(DiagnosticsProperty('ownerUri', ownerUri)) + ..add(DiagnosticsProperty('ref', ref)) + ..add(DiagnosticsProperty('eval', eval)) + ..add( + DiagnosticsProperty('isDefinedByDependency', isDefinedByDependency)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(name) ^ - const DeepCollectionEquality().hash(isFinal) ^ - const DeepCollectionEquality().hash(ownerName) ^ - const DeepCollectionEquality().hash(ownerUri) ^ - const DeepCollectionEquality().hash(ref) ^ - const DeepCollectionEquality().hash(eval) ^ - const DeepCollectionEquality().hash(isDefinedByDependency); + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ObjectField && + const DeepCollectionEquality().equals(other.name, name) && + const DeepCollectionEquality().equals(other.isFinal, isFinal) && + const DeepCollectionEquality().equals(other.ownerName, ownerName) && + const DeepCollectionEquality().equals(other.ownerUri, ownerUri) && + const DeepCollectionEquality().equals(other.ref, ref) && + const DeepCollectionEquality().equals(other.eval, eval) && + const DeepCollectionEquality() + .equals(other.isDefinedByDependency, isDefinedByDependency)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(name), + const DeepCollectionEquality().hash(isFinal), + const DeepCollectionEquality().hash(ownerName), + const DeepCollectionEquality().hash(ownerUri), + const DeepCollectionEquality().hash(ref), + const DeepCollectionEquality().hash(eval), + const DeepCollectionEquality().hash(isDefinedByDependency)); @JsonKey(ignore: true) @override @@ -754,15 +881,15 @@ class _$_ObjectField extends _ObjectField { } abstract class _ObjectField extends ObjectField { - _ObjectField._() : super._(); factory _ObjectField( - {@required String name, - @required bool isFinal, - @required String ownerName, - @required String ownerUri, - @required @nullable Result ref, - @required EvalOnDartLibrary eval, - @required bool isDefinedByDependency}) = _$_ObjectField; + {required String name, + required bool isFinal, + required String ownerName, + required String ownerUri, + required Result ref, + required EvalOnDartLibrary eval, + required bool isDefinedByDependency}) = _$_ObjectField; + _ObjectField._() : super._(); @override String get name; @@ -773,7 +900,6 @@ abstract class _ObjectField extends ObjectField { @override String get ownerUri; @override - @nullable Result get ref; @override @@ -787,27 +913,22 @@ abstract class _ObjectField extends ObjectField { bool get isDefinedByDependency; @override @JsonKey(ignore: true) - _$ObjectFieldCopyWith<_ObjectField> get copyWith; + _$ObjectFieldCopyWith<_ObjectField> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc class _$InstanceDetailsTearOff { const _$InstanceDetailsTearOff(); -// ignore: unused_element - NullInstance nill( - {String instanceRefId, - @required @nullable Future Function(String) setter}) { + NullInstance nill({required Setter? setter}) { return NullInstance( - instanceRefId: instanceRefId, setter: setter, ); } -// ignore: unused_element BoolInstance boolean(String displayString, - {@required String instanceRefId, - @required @nullable Future Function(String) setter}) { + {required String instanceRefId, required Setter? setter}) { return BoolInstance( displayString, instanceRefId: instanceRefId, @@ -815,10 +936,8 @@ class _$InstanceDetailsTearOff { ); } -// ignore: unused_element NumInstance number(String displayString, - {@required String instanceRefId, - @required @nullable Future Function(String) setter}) { + {required String instanceRefId, required Setter? setter}) { return NumInstance( displayString, instanceRefId: instanceRefId, @@ -826,10 +945,8 @@ class _$InstanceDetailsTearOff { ); } -// ignore: unused_element StringInstance string(String displayString, - {@required String instanceRefId, - @required @nullable Future Function(String) setter}) { + {required String instanceRefId, required Setter? setter}) { return StringInstance( displayString, instanceRefId: instanceRefId, @@ -837,11 +954,10 @@ class _$InstanceDetailsTearOff { ); } -// ignore: unused_element MapInstance map(List keys, - {@required int hash, - @required String instanceRefId, - @required @nullable Future Function(String) setter}) { + {required int hash, + required String instanceRefId, + required Setter? setter}) { return MapInstance( keys, hash: hash, @@ -850,12 +966,11 @@ class _$InstanceDetailsTearOff { ); } -// ignore: unused_element ListInstance list( - {@required @nullable int length, - @required int hash, - @required String instanceRefId, - @required @nullable Future Function(String) setter}) { + {required int length, + required int hash, + required String instanceRefId, + required Setter? setter}) { return ListInstance( length: length, hash: hash, @@ -864,13 +979,12 @@ class _$InstanceDetailsTearOff { ); } -// ignore: unused_element ObjectInstance object(List fields, - {@required String type, - @required int hash, - @required String instanceRefId, - @required @nullable Future Function(String) setter, - @required EvalOnDartLibrary evalForInstance}) { + {required String type, + required int hash, + required String instanceRefId, + required Setter? setter, + required EvalOnDartLibrary evalForInstance}) { return ObjectInstance( fields, type: type, @@ -881,12 +995,11 @@ class _$InstanceDetailsTearOff { ); } -// ignore: unused_element EnumInstance enumeration( - {@required String type, - @required String value, - @required @nullable Future Function(String) setter, - @required String instanceRefId}) { + {required String type, + required String value, + required Setter? setter, + required String instanceRefId}) { return EnumInstance( type: type, value: value, @@ -897,101 +1010,147 @@ class _$InstanceDetailsTearOff { } /// @nodoc -// ignore: unused_element const $InstanceDetails = _$InstanceDetailsTearOff(); /// @nodoc mixin _$InstanceDetails { - String get instanceRefId; - @nullable - Future Function(String) get setter; - - @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + Setter? get setter => throw _privateConstructorUsedError; + + @optionalTypeArgs + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }); - @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }); - @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), - }); - @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), - }); + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; @JsonKey(ignore: true) - $InstanceDetailsCopyWith get copyWith; + $InstanceDetailsCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -999,8 +1158,7 @@ abstract class $InstanceDetailsCopyWith<$Res> { factory $InstanceDetailsCopyWith( InstanceDetails value, $Res Function(InstanceDetails) then) = _$InstanceDetailsCopyWithImpl<$Res>; - $Res call( - {String instanceRefId, @nullable Future Function(String) setter}); + $Res call({Setter? setter}); } /// @nodoc @@ -1014,16 +1172,13 @@ class _$InstanceDetailsCopyWithImpl<$Res> @override $Res call({ - Object instanceRefId = freezed, - Object setter = freezed, + Object? setter = freezed, }) { return _then(_value.copyWith( - instanceRefId: instanceRefId == freezed - ? _value.instanceRefId - : instanceRefId as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } @@ -1035,8 +1190,7 @@ abstract class $NullInstanceCopyWith<$Res> NullInstance value, $Res Function(NullInstance) then) = _$NullInstanceCopyWithImpl<$Res>; @override - $Res call( - {String instanceRefId, @nullable Future Function(String) setter}); + $Res call({Setter? setter}); } /// @nodoc @@ -1052,53 +1206,48 @@ class _$NullInstanceCopyWithImpl<$Res> @override $Res call({ - Object instanceRefId = freezed, - Object setter = freezed, + Object? setter = freezed, }) { return _then(NullInstance( - instanceRefId: instanceRefId == freezed - ? _value.instanceRefId - : instanceRefId as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } /// @nodoc -class _$NullInstance extends NullInstance { - _$NullInstance({this.instanceRefId, @required @nullable this.setter}) - : assert(instanceRefId == null), - super._(); + +class _$NullInstance extends NullInstance with DiagnosticableTreeMixin { + _$NullInstance({required this.setter}) : super._(); @override - final String instanceRefId; + final Setter? setter; + @override - @nullable - final Future Function(String) setter; + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'InstanceDetails.nill(setter: $setter)'; + } @override - String toString() { - return 'InstanceDetails.nill(instanceRefId: $instanceRefId, setter: $setter)'; + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.nill')) + ..add(DiagnosticsProperty('setter', setter)); } @override bool operator ==(dynamic other) { return identical(this, other) || - (other is NullInstance && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter))); + (other.runtimeType == runtimeType && + other is NullInstance && + (identical(other.setter, setter) || other.setter == setter)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter); + int get hashCode => Object.hash(runtimeType, setter); @JsonKey(ignore: true) @override @@ -1107,121 +1256,153 @@ class _$NullInstance extends NullInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { + return nill(setter); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); - return nill(instanceRefId, setter); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return nill?.call(setter); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (nill != null) { - return nill(instanceRefId, setter); + return nill(setter); } return orElse(); } @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return nill(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return nill?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (nill != null) { return nill(this); } @@ -1230,20 +1411,15 @@ class _$NullInstance extends NullInstance { } abstract class NullInstance extends InstanceDetails { + factory NullInstance({required Setter? setter}) = _$NullInstance; NullInstance._() : super._(); - factory NullInstance( - {String instanceRefId, - @required @nullable Future Function(String) setter}) = - _$NullInstance; @override - String get instanceRefId; - @override - @nullable - Future Function(String) get setter; + Setter? get setter; @override @JsonKey(ignore: true) - $NullInstanceCopyWith get copyWith; + $NullInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -1253,10 +1429,7 @@ abstract class $BoolInstanceCopyWith<$Res> BoolInstance value, $Res Function(BoolInstance) then) = _$BoolInstanceCopyWithImpl<$Res>; @override - $Res call( - {String displayString, - String instanceRefId, - @nullable Future Function(String) setter}); + $Res call({String displayString, String instanceRefId, Setter? setter}); } /// @nodoc @@ -1272,63 +1445,74 @@ class _$BoolInstanceCopyWithImpl<$Res> @override $Res call({ - Object displayString = freezed, - Object instanceRefId = freezed, - Object setter = freezed, + Object? displayString = freezed, + Object? instanceRefId = freezed, + Object? setter = freezed, }) { return _then(BoolInstance( - displayString == freezed ? _value.displayString : displayString as String, + displayString == freezed + ? _value.displayString + : displayString // ignore: cast_nullable_to_non_nullable + as String, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } /// @nodoc -class _$BoolInstance extends BoolInstance { + +class _$BoolInstance extends BoolInstance with DiagnosticableTreeMixin { _$BoolInstance(this.displayString, - {@required this.instanceRefId, @required @nullable this.setter}) - : assert(displayString != null), - assert(instanceRefId != null), - super._(); + {required this.instanceRefId, required this.setter}) + : super._(); @override final String displayString; @override final String instanceRefId; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.boolean(displayString: $displayString, instanceRefId: $instanceRefId, setter: $setter)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.boolean')) + ..add(DiagnosticsProperty('displayString', displayString)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)) + ..add(DiagnosticsProperty('setter', setter)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is BoolInstance && - (identical(other.displayString, displayString) || - const DeepCollectionEquality() - .equals(other.displayString, displayString)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter))); + (other.runtimeType == runtimeType && + other is BoolInstance && + const DeepCollectionEquality() + .equals(other.displayString, displayString) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId) && + (identical(other.setter, setter) || other.setter == setter)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(displayString) ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(displayString), + const DeepCollectionEquality().hash(instanceRefId), + setter); @JsonKey(ignore: true) @override @@ -1337,78 +1521,104 @@ class _$BoolInstance extends BoolInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return boolean(displayString, instanceRefId, setter); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return boolean?.call(displayString, instanceRefId, setter); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (boolean != null) { return boolean(displayString, instanceRefId, setter); } @@ -1417,41 +1627,47 @@ class _$BoolInstance extends BoolInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return boolean(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return boolean?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (boolean != null) { return boolean(this); } @@ -1460,21 +1676,19 @@ class _$BoolInstance extends BoolInstance { } abstract class BoolInstance extends InstanceDetails { - BoolInstance._() : super._(); factory BoolInstance(String displayString, - {@required String instanceRefId, - @required @nullable Future Function(String) setter}) = - _$BoolInstance; + {required String instanceRefId, + required Setter? setter}) = _$BoolInstance; + BoolInstance._() : super._(); String get displayString; - @override String get instanceRefId; @override - @nullable - Future Function(String) get setter; + Setter? get setter; @override @JsonKey(ignore: true) - $BoolInstanceCopyWith get copyWith; + $BoolInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -1484,10 +1698,7 @@ abstract class $NumInstanceCopyWith<$Res> NumInstance value, $Res Function(NumInstance) then) = _$NumInstanceCopyWithImpl<$Res>; @override - $Res call( - {String displayString, - String instanceRefId, - @nullable Future Function(String) setter}); + $Res call({String displayString, String instanceRefId, Setter? setter}); } /// @nodoc @@ -1503,63 +1714,74 @@ class _$NumInstanceCopyWithImpl<$Res> @override $Res call({ - Object displayString = freezed, - Object instanceRefId = freezed, - Object setter = freezed, + Object? displayString = freezed, + Object? instanceRefId = freezed, + Object? setter = freezed, }) { return _then(NumInstance( - displayString == freezed ? _value.displayString : displayString as String, + displayString == freezed + ? _value.displayString + : displayString // ignore: cast_nullable_to_non_nullable + as String, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } /// @nodoc -class _$NumInstance extends NumInstance { + +class _$NumInstance extends NumInstance with DiagnosticableTreeMixin { _$NumInstance(this.displayString, - {@required this.instanceRefId, @required @nullable this.setter}) - : assert(displayString != null), - assert(instanceRefId != null), - super._(); + {required this.instanceRefId, required this.setter}) + : super._(); @override final String displayString; @override final String instanceRefId; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.number(displayString: $displayString, instanceRefId: $instanceRefId, setter: $setter)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.number')) + ..add(DiagnosticsProperty('displayString', displayString)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)) + ..add(DiagnosticsProperty('setter', setter)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is NumInstance && - (identical(other.displayString, displayString) || - const DeepCollectionEquality() - .equals(other.displayString, displayString)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter))); + (other.runtimeType == runtimeType && + other is NumInstance && + const DeepCollectionEquality() + .equals(other.displayString, displayString) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId) && + (identical(other.setter, setter) || other.setter == setter)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(displayString) ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(displayString), + const DeepCollectionEquality().hash(instanceRefId), + setter); @JsonKey(ignore: true) @override @@ -1568,78 +1790,104 @@ class _$NumInstance extends NumInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return number(displayString, instanceRefId, setter); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return number?.call(displayString, instanceRefId, setter); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (number != null) { return number(displayString, instanceRefId, setter); } @@ -1648,41 +1896,47 @@ class _$NumInstance extends NumInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return number(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return number?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (number != null) { return number(this); } @@ -1691,21 +1945,18 @@ class _$NumInstance extends NumInstance { } abstract class NumInstance extends InstanceDetails { - NumInstance._() : super._(); factory NumInstance(String displayString, - {@required String instanceRefId, - @required @nullable Future Function(String) setter}) = - _$NumInstance; + {required String instanceRefId, required Setter? setter}) = _$NumInstance; + NumInstance._() : super._(); String get displayString; - @override String get instanceRefId; @override - @nullable - Future Function(String) get setter; + Setter? get setter; @override @JsonKey(ignore: true) - $NumInstanceCopyWith get copyWith; + $NumInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -1715,10 +1966,7 @@ abstract class $StringInstanceCopyWith<$Res> StringInstance value, $Res Function(StringInstance) then) = _$StringInstanceCopyWithImpl<$Res>; @override - $Res call( - {String displayString, - String instanceRefId, - @nullable Future Function(String) setter}); + $Res call({String displayString, String instanceRefId, Setter? setter}); } /// @nodoc @@ -1734,63 +1982,74 @@ class _$StringInstanceCopyWithImpl<$Res> @override $Res call({ - Object displayString = freezed, - Object instanceRefId = freezed, - Object setter = freezed, + Object? displayString = freezed, + Object? instanceRefId = freezed, + Object? setter = freezed, }) { return _then(StringInstance( - displayString == freezed ? _value.displayString : displayString as String, + displayString == freezed + ? _value.displayString + : displayString // ignore: cast_nullable_to_non_nullable + as String, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } /// @nodoc -class _$StringInstance extends StringInstance { + +class _$StringInstance extends StringInstance with DiagnosticableTreeMixin { _$StringInstance(this.displayString, - {@required this.instanceRefId, @required @nullable this.setter}) - : assert(displayString != null), - assert(instanceRefId != null), - super._(); + {required this.instanceRefId, required this.setter}) + : super._(); @override final String displayString; @override final String instanceRefId; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.string(displayString: $displayString, instanceRefId: $instanceRefId, setter: $setter)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.string')) + ..add(DiagnosticsProperty('displayString', displayString)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)) + ..add(DiagnosticsProperty('setter', setter)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is StringInstance && - (identical(other.displayString, displayString) || - const DeepCollectionEquality() - .equals(other.displayString, displayString)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter))); + (other.runtimeType == runtimeType && + other is StringInstance && + const DeepCollectionEquality() + .equals(other.displayString, displayString) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId) && + (identical(other.setter, setter) || other.setter == setter)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(displayString) ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(displayString), + const DeepCollectionEquality().hash(instanceRefId), + setter); @JsonKey(ignore: true) @override @@ -1799,78 +2058,104 @@ class _$StringInstance extends StringInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return string(displayString, instanceRefId, setter); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return string?.call(displayString, instanceRefId, setter); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (string != null) { return string(displayString, instanceRefId, setter); } @@ -1879,41 +2164,47 @@ class _$StringInstance extends StringInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return string(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return string?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (string != null) { return string(this); } @@ -1922,21 +2213,19 @@ class _$StringInstance extends StringInstance { } abstract class StringInstance extends InstanceDetails { - StringInstance._() : super._(); factory StringInstance(String displayString, - {@required String instanceRefId, - @required @nullable Future Function(String) setter}) = - _$StringInstance; + {required String instanceRefId, + required Setter? setter}) = _$StringInstance; + StringInstance._() : super._(); String get displayString; - @override String get instanceRefId; @override - @nullable - Future Function(String) get setter; + Setter? get setter; @override @JsonKey(ignore: true) - $StringInstanceCopyWith get copyWith; + $StringInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -1950,7 +2239,7 @@ abstract class $MapInstanceCopyWith<$Res> {List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter}); + Setter? setter}); } /// @nodoc @@ -1966,34 +2255,38 @@ class _$MapInstanceCopyWithImpl<$Res> @override $Res call({ - Object keys = freezed, - Object hash = freezed, - Object instanceRefId = freezed, - Object setter = freezed, + Object? keys = freezed, + Object? hash = freezed, + Object? instanceRefId = freezed, + Object? setter = freezed, }) { return _then(MapInstance( - keys == freezed ? _value.keys : keys as List, - hash: hash == freezed ? _value.hash : hash as int, + keys == freezed + ? _value.keys + : keys // ignore: cast_nullable_to_non_nullable + as List, + hash: hash == freezed + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as int, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } /// @nodoc -class _$MapInstance extends MapInstance { + +class _$MapInstance extends MapInstance with DiagnosticableTreeMixin { _$MapInstance(this.keys, - {@required this.hash, - @required this.instanceRefId, - @required @nullable this.setter}) - : assert(keys != null), - assert(hash != null), - assert(instanceRefId != null), - super._(); + {required this.hash, required this.instanceRefId, required this.setter}) + : super._(); @override final List keys; @@ -2002,36 +2295,43 @@ class _$MapInstance extends MapInstance { @override final String instanceRefId; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.map(keys: $keys, hash: $hash, instanceRefId: $instanceRefId, setter: $setter)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.map')) + ..add(DiagnosticsProperty('keys', keys)) + ..add(DiagnosticsProperty('hash', hash)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)) + ..add(DiagnosticsProperty('setter', setter)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is MapInstance && - (identical(other.keys, keys) || - const DeepCollectionEquality().equals(other.keys, keys)) && - (identical(other.hash, hash) || - const DeepCollectionEquality().equals(other.hash, hash)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter))); + (other.runtimeType == runtimeType && + other is MapInstance && + const DeepCollectionEquality().equals(other.keys, keys) && + const DeepCollectionEquality().equals(other.hash, hash) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId) && + (identical(other.setter, setter) || other.setter == setter)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(keys) ^ - const DeepCollectionEquality().hash(hash) ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(keys), + const DeepCollectionEquality().hash(hash), + const DeepCollectionEquality().hash(instanceRefId), + setter); @JsonKey(ignore: true) @override @@ -2040,78 +2340,104 @@ class _$MapInstance extends MapInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return map(keys, hash, instanceRefId, setter); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return map?.call(keys, hash, instanceRefId, setter); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (map != null) { return map(keys, hash, instanceRefId, setter); } @@ -2120,41 +2446,47 @@ class _$MapInstance extends MapInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return map(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return map?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (map != null) { return map(this); } @@ -2163,23 +2495,21 @@ class _$MapInstance extends MapInstance { } abstract class MapInstance extends InstanceDetails { - MapInstance._() : super._(); factory MapInstance(List keys, - {@required int hash, - @required String instanceRefId, - @required @nullable Future Function(String) setter}) = - _$MapInstance; + {required int hash, + required String instanceRefId, + required Setter? setter}) = _$MapInstance; + MapInstance._() : super._(); List get keys; int get hash; - @override String get instanceRefId; @override - @nullable - Future Function(String) get setter; + Setter? get setter; @override @JsonKey(ignore: true) - $MapInstanceCopyWith get copyWith; + $MapInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -2189,11 +2519,7 @@ abstract class $ListInstanceCopyWith<$Res> ListInstance value, $Res Function(ListInstance) then) = _$ListInstanceCopyWithImpl<$Res>; @override - $Res call( - {@nullable int length, - int hash, - String instanceRefId, - @nullable Future Function(String) setter}); + $Res call({int length, int hash, String instanceRefId, Setter? setter}); } /// @nodoc @@ -2209,73 +2535,86 @@ class _$ListInstanceCopyWithImpl<$Res> @override $Res call({ - Object length = freezed, - Object hash = freezed, - Object instanceRefId = freezed, - Object setter = freezed, + Object? length = freezed, + Object? hash = freezed, + Object? instanceRefId = freezed, + Object? setter = freezed, }) { return _then(ListInstance( - length: length == freezed ? _value.length : length as int, - hash: hash == freezed ? _value.hash : hash as int, + length: length == freezed + ? _value.length + : length // ignore: cast_nullable_to_non_nullable + as int, + hash: hash == freezed + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as int, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, )); } } /// @nodoc -class _$ListInstance extends ListInstance { + +class _$ListInstance extends ListInstance with DiagnosticableTreeMixin { _$ListInstance( - {@required @nullable this.length, - @required this.hash, - @required this.instanceRefId, - @required @nullable this.setter}) - : assert(hash != null), - assert(instanceRefId != null), - super._(); + {required this.length, + required this.hash, + required this.instanceRefId, + required this.setter}) + : super._(); @override - @nullable final int length; @override final int hash; @override final String instanceRefId; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.list(length: $length, hash: $hash, instanceRefId: $instanceRefId, setter: $setter)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.list')) + ..add(DiagnosticsProperty('length', length)) + ..add(DiagnosticsProperty('hash', hash)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)) + ..add(DiagnosticsProperty('setter', setter)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is ListInstance && - (identical(other.length, length) || - const DeepCollectionEquality().equals(other.length, length)) && - (identical(other.hash, hash) || - const DeepCollectionEquality().equals(other.hash, hash)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter))); + (other.runtimeType == runtimeType && + other is ListInstance && + const DeepCollectionEquality().equals(other.length, length) && + const DeepCollectionEquality().equals(other.hash, hash) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId) && + (identical(other.setter, setter) || other.setter == setter)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(length) ^ - const DeepCollectionEquality().hash(hash) ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(length), + const DeepCollectionEquality().hash(hash), + const DeepCollectionEquality().hash(instanceRefId), + setter); @JsonKey(ignore: true) @override @@ -2284,78 +2623,104 @@ class _$ListInstance extends ListInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return list(length, hash, instanceRefId, setter); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return list?.call(length, hash, instanceRefId, setter); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (list != null) { return list(length, hash, instanceRefId, setter); } @@ -2364,41 +2729,47 @@ class _$ListInstance extends ListInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return list(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return list?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (list != null) { return list(this); } @@ -2407,25 +2778,22 @@ class _$ListInstance extends ListInstance { } abstract class ListInstance extends InstanceDetails { - ListInstance._() : super._(); factory ListInstance( - {@required @nullable int length, - @required int hash, - @required String instanceRefId, - @required @nullable Future Function(String) setter}) = - _$ListInstance; + {required int length, + required int hash, + required String instanceRefId, + required Setter? setter}) = _$ListInstance; + ListInstance._() : super._(); - @nullable int get length; int get hash; - @override String get instanceRefId; @override - @nullable - Future Function(String) get setter; + Setter? get setter; @override @JsonKey(ignore: true) - $ListInstanceCopyWith get copyWith; + $ListInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -2440,7 +2808,7 @@ abstract class $ObjectInstanceCopyWith<$Res> String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, + Setter? setter, EvalOnDartLibrary evalForInstance}); } @@ -2457,44 +2825,52 @@ class _$ObjectInstanceCopyWithImpl<$Res> @override $Res call({ - Object fields = freezed, - Object type = freezed, - Object hash = freezed, - Object instanceRefId = freezed, - Object setter = freezed, - Object evalForInstance = freezed, + Object? fields = freezed, + Object? type = freezed, + Object? hash = freezed, + Object? instanceRefId = freezed, + Object? setter = freezed, + Object? evalForInstance = freezed, }) { return _then(ObjectInstance( - fields == freezed ? _value.fields : fields as List, - type: type == freezed ? _value.type : type as String, - hash: hash == freezed ? _value.hash : hash as int, + fields == freezed + ? _value.fields + : fields // ignore: cast_nullable_to_non_nullable + as List, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + hash: hash == freezed + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as int, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, evalForInstance: evalForInstance == freezed ? _value.evalForInstance - : evalForInstance as EvalOnDartLibrary, + : evalForInstance // ignore: cast_nullable_to_non_nullable + as EvalOnDartLibrary, )); } } /// @nodoc -class _$ObjectInstance extends ObjectInstance { + +class _$ObjectInstance extends ObjectInstance with DiagnosticableTreeMixin { _$ObjectInstance(this.fields, - {@required this.type, - @required this.hash, - @required this.instanceRefId, - @required @nullable this.setter, - @required this.evalForInstance}) - : assert(fields != null), - assert(type != null), - assert(hash != null), - assert(instanceRefId != null), - assert(evalForInstance != null), - super._(); + {required this.type, + required this.hash, + required this.instanceRefId, + required this.setter, + required this.evalForInstance}) + : super._(); @override final List fields; @@ -2505,8 +2881,7 @@ class _$ObjectInstance extends ObjectInstance { @override final String instanceRefId; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override /// An [EvalOnDartLibrary] associated with the library of this object @@ -2515,39 +2890,47 @@ class _$ObjectInstance extends ObjectInstance { final EvalOnDartLibrary evalForInstance; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.object(fields: $fields, type: $type, hash: $hash, instanceRefId: $instanceRefId, setter: $setter, evalForInstance: $evalForInstance)'; } @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other is ObjectInstance && - (identical(other.fields, fields) || - const DeepCollectionEquality().equals(other.fields, fields)) && - (identical(other.type, type) || - const DeepCollectionEquality().equals(other.type, type)) && - (identical(other.hash, hash) || - const DeepCollectionEquality().equals(other.hash, hash)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter)) && - (identical(other.evalForInstance, evalForInstance) || - const DeepCollectionEquality() - .equals(other.evalForInstance, evalForInstance))); + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.object')) + ..add(DiagnosticsProperty('fields', fields)) + ..add(DiagnosticsProperty('type', type)) + ..add(DiagnosticsProperty('hash', hash)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)) + ..add(DiagnosticsProperty('setter', setter)) + ..add(DiagnosticsProperty('evalForInstance', evalForInstance)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(fields) ^ - const DeepCollectionEquality().hash(type) ^ - const DeepCollectionEquality().hash(hash) ^ - const DeepCollectionEquality().hash(instanceRefId) ^ - const DeepCollectionEquality().hash(setter) ^ - const DeepCollectionEquality().hash(evalForInstance); + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ObjectInstance && + const DeepCollectionEquality().equals(other.fields, fields) && + const DeepCollectionEquality().equals(other.type, type) && + const DeepCollectionEquality().equals(other.hash, hash) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId) && + (identical(other.setter, setter) || other.setter == setter) && + const DeepCollectionEquality() + .equals(other.evalForInstance, evalForInstance)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(fields), + const DeepCollectionEquality().hash(type), + const DeepCollectionEquality().hash(hash), + const DeepCollectionEquality().hash(instanceRefId), + setter, + const DeepCollectionEquality().hash(evalForInstance)); @JsonKey(ignore: true) @override @@ -2556,78 +2939,105 @@ class _$ObjectInstance extends ObjectInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return object(fields, type, hash, instanceRefId, setter, evalForInstance); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return object?.call( + fields, type, hash, instanceRefId, setter, evalForInstance); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (object != null) { return object(fields, type, hash, instanceRefId, setter, evalForInstance); } @@ -2636,41 +3046,47 @@ class _$ObjectInstance extends ObjectInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return object(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return object?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (object != null) { return object(this); } @@ -2679,22 +3095,20 @@ class _$ObjectInstance extends ObjectInstance { } abstract class ObjectInstance extends InstanceDetails { - ObjectInstance._() : super._(); factory ObjectInstance(List fields, - {@required String type, - @required int hash, - @required String instanceRefId, - @required @nullable Future Function(String) setter, - @required EvalOnDartLibrary evalForInstance}) = _$ObjectInstance; + {required String type, + required int hash, + required String instanceRefId, + required Setter? setter, + required EvalOnDartLibrary evalForInstance}) = _$ObjectInstance; + ObjectInstance._() : super._(); List get fields; String get type; int get hash; - @override String get instanceRefId; @override - @nullable - Future Function(String) get setter; + Setter? get setter; /// An [EvalOnDartLibrary] associated with the library of this object /// @@ -2702,7 +3116,8 @@ abstract class ObjectInstance extends InstanceDetails { EvalOnDartLibrary get evalForInstance; @override @JsonKey(ignore: true) - $ObjectInstanceCopyWith get copyWith; + $ObjectInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -2712,11 +3127,7 @@ abstract class $EnumInstanceCopyWith<$Res> EnumInstance value, $Res Function(EnumInstance) then) = _$EnumInstanceCopyWithImpl<$Res>; @override - $Res call( - {String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId}); + $Res call({String type, String value, Setter? setter, String instanceRefId}); } /// @nodoc @@ -2732,73 +3143,86 @@ class _$EnumInstanceCopyWithImpl<$Res> @override $Res call({ - Object type = freezed, - Object value = freezed, - Object setter = freezed, - Object instanceRefId = freezed, + Object? type = freezed, + Object? value = freezed, + Object? setter = freezed, + Object? instanceRefId = freezed, }) { return _then(EnumInstance( - type: type == freezed ? _value.type : type as String, - value: value == freezed ? _value.value : value as String, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + value: value == freezed + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, setter: setter == freezed ? _value.setter - : setter as Future Function(String), + : setter // ignore: cast_nullable_to_non_nullable + as Setter?, instanceRefId: instanceRefId == freezed ? _value.instanceRefId - : instanceRefId as String, + : instanceRefId // ignore: cast_nullable_to_non_nullable + as String, )); } } /// @nodoc -class _$EnumInstance extends EnumInstance { + +class _$EnumInstance extends EnumInstance with DiagnosticableTreeMixin { _$EnumInstance( - {@required this.type, - @required this.value, - @required @nullable this.setter, - @required this.instanceRefId}) - : assert(type != null), - assert(value != null), - assert(instanceRefId != null), - super._(); + {required this.type, + required this.value, + required this.setter, + required this.instanceRefId}) + : super._(); @override final String type; @override final String value; @override - @nullable - final Future Function(String) setter; + final Setter? setter; @override final String instanceRefId; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstanceDetails.enumeration(type: $type, value: $value, setter: $setter, instanceRefId: $instanceRefId)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstanceDetails.enumeration')) + ..add(DiagnosticsProperty('type', type)) + ..add(DiagnosticsProperty('value', value)) + ..add(DiagnosticsProperty('setter', setter)) + ..add(DiagnosticsProperty('instanceRefId', instanceRefId)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is EnumInstance && - (identical(other.type, type) || - const DeepCollectionEquality().equals(other.type, type)) && - (identical(other.value, value) || - const DeepCollectionEquality().equals(other.value, value)) && - (identical(other.setter, setter) || - const DeepCollectionEquality().equals(other.setter, setter)) && - (identical(other.instanceRefId, instanceRefId) || - const DeepCollectionEquality() - .equals(other.instanceRefId, instanceRefId))); + (other.runtimeType == runtimeType && + other is EnumInstance && + const DeepCollectionEquality().equals(other.type, type) && + const DeepCollectionEquality().equals(other.value, value) && + (identical(other.setter, setter) || other.setter == setter) && + const DeepCollectionEquality() + .equals(other.instanceRefId, instanceRefId)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(type) ^ - const DeepCollectionEquality().hash(value) ^ - const DeepCollectionEquality().hash(setter) ^ - const DeepCollectionEquality().hash(instanceRefId); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(type), + const DeepCollectionEquality().hash(value), + setter, + const DeepCollectionEquality().hash(instanceRefId)); @JsonKey(ignore: true) @override @@ -2807,78 +3231,104 @@ class _$EnumInstance extends EnumInstance { @override @optionalTypeArgs - TResult when({ - @required - TResult nill(String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - @required - TResult object( + TResult when({ + required TResult Function(Setter? setter) nill, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + boolean, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + number, + required TResult Function( + String displayString, String instanceRefId, Setter? setter) + string, + required TResult Function(List keys, int hash, + String instanceRefId, Setter? setter) + map, + required TResult Function( + int length, int hash, String instanceRefId, Setter? setter) + list, + required TResult Function( List fields, String type, int hash, String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - @required - TResult enumeration( - String type, - String value, - @nullable Future Function(String) setter, - String instanceRefId), - }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); + Setter? setter, + EvalOnDartLibrary evalForInstance) + object, + required TResult Function( + String type, String value, Setter? setter, String instanceRefId) + enumeration, + }) { return enumeration(type, value, setter, instanceRefId); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult nill( - String instanceRefId, @nullable Future Function(String) setter), - TResult boolean(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult number(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult string(String displayString, String instanceRefId, - @nullable Future Function(String) setter), - TResult map(List keys, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult list(@nullable int length, int hash, String instanceRefId, - @nullable Future Function(String) setter), - TResult object( - List fields, - String type, - int hash, - String instanceRefId, - @nullable Future Function(String) setter, - EvalOnDartLibrary evalForInstance), - TResult enumeration(String type, String value, - @nullable Future Function(String) setter, String instanceRefId), - @required TResult orElse(), - }) { - assert(orElse != null); + TResult? whenOrNull({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + }) { + return enumeration?.call(type, value, setter, instanceRefId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(Setter? setter)? nill, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + boolean, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + number, + TResult Function( + String displayString, String instanceRefId, Setter? setter)? + string, + TResult Function(List keys, int hash, String instanceRefId, + Setter? setter)? + map, + TResult Function( + int length, int hash, String instanceRefId, Setter? setter)? + list, + TResult Function( + List fields, + String type, + int hash, + String instanceRefId, + Setter? setter, + EvalOnDartLibrary evalForInstance)? + object, + TResult Function( + String type, String value, Setter? setter, String instanceRefId)? + enumeration, + required TResult orElse(), + }) { if (enumeration != null) { return enumeration(type, value, setter, instanceRefId); } @@ -2887,41 +3337,47 @@ class _$EnumInstance extends EnumInstance { @override @optionalTypeArgs - TResult map({ - @required TResult nill(NullInstance value), - @required TResult boolean(BoolInstance value), - @required TResult number(NumInstance value), - @required TResult string(StringInstance value), - @required TResult map(MapInstance value), - @required TResult list(ListInstance value), - @required TResult object(ObjectInstance value), - @required TResult enumeration(EnumInstance value), + TResult map({ + required TResult Function(NullInstance value) nill, + required TResult Function(BoolInstance value) boolean, + required TResult Function(NumInstance value) number, + required TResult Function(StringInstance value) string, + required TResult Function(MapInstance value) map, + required TResult Function(ListInstance value) list, + required TResult Function(ObjectInstance value) object, + required TResult Function(EnumInstance value) enumeration, }) { - assert(nill != null); - assert(boolean != null); - assert(number != null); - assert(string != null); - assert(map != null); - assert(list != null); - assert(object != null); - assert(enumeration != null); return enumeration(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult nill(NullInstance value), - TResult boolean(BoolInstance value), - TResult number(NumInstance value), - TResult string(StringInstance value), - TResult map(MapInstance value), - TResult list(ListInstance value), - TResult object(ObjectInstance value), - TResult enumeration(EnumInstance value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + }) { + return enumeration?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(NullInstance value)? nill, + TResult Function(BoolInstance value)? boolean, + TResult Function(NumInstance value)? number, + TResult Function(StringInstance value)? string, + TResult Function(MapInstance value)? map, + TResult Function(ListInstance value)? list, + TResult Function(ObjectInstance value)? object, + TResult Function(EnumInstance value)? enumeration, + required TResult orElse(), }) { - assert(orElse != null); if (enumeration != null) { return enumeration(this); } @@ -2930,31 +3386,29 @@ class _$EnumInstance extends EnumInstance { } abstract class EnumInstance extends InstanceDetails { - EnumInstance._() : super._(); factory EnumInstance( - {@required String type, - @required String value, - @required @nullable Future Function(String) setter, - @required String instanceRefId}) = _$EnumInstance; + {required String type, + required String value, + required Setter? setter, + required String instanceRefId}) = _$EnumInstance; + EnumInstance._() : super._(); String get type; String get value; @override - @nullable - Future Function(String) get setter; - @override + Setter? get setter; String get instanceRefId; @override @JsonKey(ignore: true) - $EnumInstanceCopyWith get copyWith; + $EnumInstanceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc class _$InstancePathTearOff { const _$InstancePathTearOff(); -// ignore: unused_element - _InstancePathFromInstanceId fromInstanceId(@nullable String instanceId, + _InstancePathFromInstanceId fromInstanceId(String instanceId, {List pathToProperty = const []}) { return _InstancePathFromInstanceId( instanceId, @@ -2962,7 +3416,6 @@ class _$InstancePathTearOff { ); } -// ignore: unused_element _InstancePathFromProviderId fromProviderId(String providerId, {List pathToProperty = const []}) { return _InstancePathFromProviderId( @@ -2973,44 +3426,62 @@ class _$InstancePathTearOff { } /// @nodoc -// ignore: unused_element const $InstancePath = _$InstancePathTearOff(); /// @nodoc mixin _$InstancePath { - List get pathToProperty; - - @optionalTypeArgs - TResult when({ - @required - TResult fromInstanceId( - @nullable String instanceId, List pathToProperty), - @required - TResult fromProviderId( - String providerId, List pathToProperty), - }); - @optionalTypeArgs - TResult maybeWhen({ - TResult fromInstanceId( - @nullable String instanceId, List pathToProperty), - TResult fromProviderId( - String providerId, List pathToProperty), - @required TResult orElse(), - }); - @optionalTypeArgs - TResult map({ - @required TResult fromInstanceId(_InstancePathFromInstanceId value), - @required TResult fromProviderId(_InstancePathFromProviderId value), - }); - @optionalTypeArgs - TResult maybeMap({ - TResult fromInstanceId(_InstancePathFromInstanceId value), - TResult fromProviderId(_InstancePathFromProviderId value), - @required TResult orElse(), - }); + List get pathToProperty => throw _privateConstructorUsedError; + + @optionalTypeArgs + TResult when({ + required TResult Function( + String instanceId, List pathToProperty) + fromInstanceId, + required TResult Function( + String providerId, List pathToProperty) + fromProviderId, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(String instanceId, List pathToProperty)? + fromInstanceId, + TResult Function(String providerId, List pathToProperty)? + fromProviderId, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String instanceId, List pathToProperty)? + fromInstanceId, + TResult Function(String providerId, List pathToProperty)? + fromProviderId, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(_InstancePathFromInstanceId value) fromInstanceId, + required TResult Function(_InstancePathFromProviderId value) fromProviderId, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(_InstancePathFromInstanceId value)? fromInstanceId, + TResult Function(_InstancePathFromProviderId value)? fromProviderId, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_InstancePathFromInstanceId value)? fromInstanceId, + TResult Function(_InstancePathFromProviderId value)? fromProviderId, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; @JsonKey(ignore: true) - $InstancePathCopyWith get copyWith; + $InstancePathCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -3031,12 +3502,13 @@ class _$InstancePathCopyWithImpl<$Res> implements $InstancePathCopyWith<$Res> { @override $Res call({ - Object pathToProperty = freezed, + Object? pathToProperty = freezed, }) { return _then(_value.copyWith( pathToProperty: pathToProperty == freezed ? _value.pathToProperty - : pathToProperty as List, + : pathToProperty // ignore: cast_nullable_to_non_nullable + as List, )); } } @@ -3049,7 +3521,7 @@ abstract class _$InstancePathFromInstanceIdCopyWith<$Res> $Res Function(_InstancePathFromInstanceId) then) = __$InstancePathFromInstanceIdCopyWithImpl<$Res>; @override - $Res call({@nullable String instanceId, List pathToProperty}); + $Res call({String instanceId, List pathToProperty}); } /// @nodoc @@ -3066,54 +3538,66 @@ class __$InstancePathFromInstanceIdCopyWithImpl<$Res> @override $Res call({ - Object instanceId = freezed, - Object pathToProperty = freezed, + Object? instanceId = freezed, + Object? pathToProperty = freezed, }) { return _then(_InstancePathFromInstanceId( - instanceId == freezed ? _value.instanceId : instanceId as String, + instanceId == freezed + ? _value.instanceId + : instanceId // ignore: cast_nullable_to_non_nullable + as String, pathToProperty: pathToProperty == freezed ? _value.pathToProperty - : pathToProperty as List, + : pathToProperty // ignore: cast_nullable_to_non_nullable + as List, )); } } /// @nodoc -class _$_InstancePathFromInstanceId extends _InstancePathFromInstanceId { - const _$_InstancePathFromInstanceId(@nullable this.instanceId, + +class _$_InstancePathFromInstanceId extends _InstancePathFromInstanceId + with DiagnosticableTreeMixin { + const _$_InstancePathFromInstanceId(this.instanceId, {this.pathToProperty = const []}) - : assert(pathToProperty != null), - super._(); + : super._(); @override - @nullable final String instanceId; - @JsonKey(defaultValue: const []) + @JsonKey() @override final List pathToProperty; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstancePath.fromInstanceId(instanceId: $instanceId, pathToProperty: $pathToProperty)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstancePath.fromInstanceId')) + ..add(DiagnosticsProperty('instanceId', instanceId)) + ..add(DiagnosticsProperty('pathToProperty', pathToProperty)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is _InstancePathFromInstanceId && - (identical(other.instanceId, instanceId) || - const DeepCollectionEquality() - .equals(other.instanceId, instanceId)) && - (identical(other.pathToProperty, pathToProperty) || - const DeepCollectionEquality() - .equals(other.pathToProperty, pathToProperty))); + (other.runtimeType == runtimeType && + other is _InstancePathFromInstanceId && + const DeepCollectionEquality() + .equals(other.instanceId, instanceId) && + const DeepCollectionEquality() + .equals(other.pathToProperty, pathToProperty)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(instanceId) ^ - const DeepCollectionEquality().hash(pathToProperty); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(instanceId), + const DeepCollectionEquality().hash(pathToProperty)); @JsonKey(ignore: true) @override @@ -3123,29 +3607,37 @@ class _$_InstancePathFromInstanceId extends _InstancePathFromInstanceId { @override @optionalTypeArgs - TResult when({ - @required - TResult fromInstanceId( - @nullable String instanceId, List pathToProperty), - @required - TResult fromProviderId( - String providerId, List pathToProperty), + TResult when({ + required TResult Function( + String instanceId, List pathToProperty) + fromInstanceId, + required TResult Function( + String providerId, List pathToProperty) + fromProviderId, }) { - assert(fromInstanceId != null); - assert(fromProviderId != null); return fromInstanceId(instanceId, pathToProperty); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult fromInstanceId( - @nullable String instanceId, List pathToProperty), - TResult fromProviderId( - String providerId, List pathToProperty), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(String instanceId, List pathToProperty)? + fromInstanceId, + TResult Function(String providerId, List pathToProperty)? + fromProviderId, + }) { + return fromInstanceId?.call(instanceId, pathToProperty); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String instanceId, List pathToProperty)? + fromInstanceId, + TResult Function(String providerId, List pathToProperty)? + fromProviderId, + required TResult orElse(), }) { - assert(orElse != null); if (fromInstanceId != null) { return fromInstanceId(instanceId, pathToProperty); } @@ -3154,23 +3646,29 @@ class _$_InstancePathFromInstanceId extends _InstancePathFromInstanceId { @override @optionalTypeArgs - TResult map({ - @required TResult fromInstanceId(_InstancePathFromInstanceId value), - @required TResult fromProviderId(_InstancePathFromProviderId value), + TResult map({ + required TResult Function(_InstancePathFromInstanceId value) fromInstanceId, + required TResult Function(_InstancePathFromProviderId value) fromProviderId, }) { - assert(fromInstanceId != null); - assert(fromProviderId != null); return fromInstanceId(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult fromInstanceId(_InstancePathFromInstanceId value), - TResult fromProviderId(_InstancePathFromProviderId value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(_InstancePathFromInstanceId value)? fromInstanceId, + TResult Function(_InstancePathFromProviderId value)? fromProviderId, + }) { + return fromInstanceId?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_InstancePathFromInstanceId value)? fromInstanceId, + TResult Function(_InstancePathFromProviderId value)? fromProviderId, + required TResult orElse(), }) { - assert(orElse != null); if (fromInstanceId != null) { return fromInstanceId(this); } @@ -3179,18 +3677,17 @@ class _$_InstancePathFromInstanceId extends _InstancePathFromInstanceId { } abstract class _InstancePathFromInstanceId extends InstancePath { - const _InstancePathFromInstanceId._() : super._(); - const factory _InstancePathFromInstanceId(@nullable String instanceId, + const factory _InstancePathFromInstanceId(String instanceId, {List pathToProperty}) = _$_InstancePathFromInstanceId; + const _InstancePathFromInstanceId._() : super._(); - @nullable String get instanceId; @override List get pathToProperty; @override @JsonKey(ignore: true) _$InstancePathFromInstanceIdCopyWith<_InstancePathFromInstanceId> - get copyWith; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc @@ -3218,54 +3715,66 @@ class __$InstancePathFromProviderIdCopyWithImpl<$Res> @override $Res call({ - Object providerId = freezed, - Object pathToProperty = freezed, + Object? providerId = freezed, + Object? pathToProperty = freezed, }) { return _then(_InstancePathFromProviderId( - providerId == freezed ? _value.providerId : providerId as String, + providerId == freezed + ? _value.providerId + : providerId // ignore: cast_nullable_to_non_nullable + as String, pathToProperty: pathToProperty == freezed ? _value.pathToProperty - : pathToProperty as List, + : pathToProperty // ignore: cast_nullable_to_non_nullable + as List, )); } } /// @nodoc -class _$_InstancePathFromProviderId extends _InstancePathFromProviderId { + +class _$_InstancePathFromProviderId extends _InstancePathFromProviderId + with DiagnosticableTreeMixin { const _$_InstancePathFromProviderId(this.providerId, {this.pathToProperty = const []}) - : assert(providerId != null), - assert(pathToProperty != null), - super._(); + : super._(); @override final String providerId; - @JsonKey(defaultValue: const []) + @JsonKey() @override final List pathToProperty; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'InstancePath.fromProviderId(providerId: $providerId, pathToProperty: $pathToProperty)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InstancePath.fromProviderId')) + ..add(DiagnosticsProperty('providerId', providerId)) + ..add(DiagnosticsProperty('pathToProperty', pathToProperty)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is _InstancePathFromProviderId && - (identical(other.providerId, providerId) || - const DeepCollectionEquality() - .equals(other.providerId, providerId)) && - (identical(other.pathToProperty, pathToProperty) || - const DeepCollectionEquality() - .equals(other.pathToProperty, pathToProperty))); + (other.runtimeType == runtimeType && + other is _InstancePathFromProviderId && + const DeepCollectionEquality() + .equals(other.providerId, providerId) && + const DeepCollectionEquality() + .equals(other.pathToProperty, pathToProperty)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(providerId) ^ - const DeepCollectionEquality().hash(pathToProperty); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(providerId), + const DeepCollectionEquality().hash(pathToProperty)); @JsonKey(ignore: true) @override @@ -3275,29 +3784,37 @@ class _$_InstancePathFromProviderId extends _InstancePathFromProviderId { @override @optionalTypeArgs - TResult when({ - @required - TResult fromInstanceId( - @nullable String instanceId, List pathToProperty), - @required - TResult fromProviderId( - String providerId, List pathToProperty), + TResult when({ + required TResult Function( + String instanceId, List pathToProperty) + fromInstanceId, + required TResult Function( + String providerId, List pathToProperty) + fromProviderId, }) { - assert(fromInstanceId != null); - assert(fromProviderId != null); return fromProviderId(providerId, pathToProperty); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult fromInstanceId( - @nullable String instanceId, List pathToProperty), - TResult fromProviderId( - String providerId, List pathToProperty), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(String instanceId, List pathToProperty)? + fromInstanceId, + TResult Function(String providerId, List pathToProperty)? + fromProviderId, + }) { + return fromProviderId?.call(providerId, pathToProperty); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String instanceId, List pathToProperty)? + fromInstanceId, + TResult Function(String providerId, List pathToProperty)? + fromProviderId, + required TResult orElse(), }) { - assert(orElse != null); if (fromProviderId != null) { return fromProviderId(providerId, pathToProperty); } @@ -3306,23 +3823,29 @@ class _$_InstancePathFromProviderId extends _InstancePathFromProviderId { @override @optionalTypeArgs - TResult map({ - @required TResult fromInstanceId(_InstancePathFromInstanceId value), - @required TResult fromProviderId(_InstancePathFromProviderId value), + TResult map({ + required TResult Function(_InstancePathFromInstanceId value) fromInstanceId, + required TResult Function(_InstancePathFromProviderId value) fromProviderId, }) { - assert(fromInstanceId != null); - assert(fromProviderId != null); return fromProviderId(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult fromInstanceId(_InstancePathFromInstanceId value), - TResult fromProviderId(_InstancePathFromProviderId value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(_InstancePathFromInstanceId value)? fromInstanceId, + TResult Function(_InstancePathFromProviderId value)? fromProviderId, + }) { + return fromProviderId?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_InstancePathFromInstanceId value)? fromInstanceId, + TResult Function(_InstancePathFromProviderId value)? fromProviderId, + required TResult orElse(), }) { - assert(orElse != null); if (fromProviderId != null) { return fromProviderId(this); } @@ -3331,9 +3854,9 @@ class _$_InstancePathFromProviderId extends _InstancePathFromProviderId { } abstract class _InstancePathFromProviderId extends InstancePath { - const _InstancePathFromProviderId._() : super._(); const factory _InstancePathFromProviderId(String providerId, {List pathToProperty}) = _$_InstancePathFromProviderId; + const _InstancePathFromProviderId._() : super._(); String get providerId; @override @@ -3341,5 +3864,5 @@ abstract class _InstancePathFromProviderId extends InstancePath { @override @JsonKey(ignore: true) _$InstancePathFromProviderIdCopyWith<_InstancePathFromProviderId> - get copyWith; + get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_providers.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_providers.dart index a625071b76c..c7e1f87cb94 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_providers.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_providers.dart @@ -2,30 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - import 'dart:async'; import 'package:collection/collection.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:vm_service/vm_service.dart' hide SentinelException; import '../../../primitives/utils.dart'; import '../../../shared/eval_on_dart_library.dart'; import '../../../shared/globals.dart'; -import '../provider_debounce.dart'; import 'eval.dart'; import 'instance_details.dart'; import 'result.dart'; Future _resolveInstanceRefForPath( InstancePath path, { - @required AutoDisposeProviderReference ref, - @required Disposable isAlive, - @required InstanceDetails parent, + required AutoDisposeRef ref, + required Disposable isAlive, + required InstanceDetails? parent, }) async { - if (path.pathToProperty.isEmpty) { + if (parent == null) { // root of the provider tree return path.map( @@ -41,8 +37,6 @@ Future _resolveInstanceRefForPath( ); }, fromInstanceId: (path) async { - if (path.instanceId == null) return null; - final eval = await ref.watch(evalProvider.future); return eval.safeEval( 'value', @@ -62,13 +56,14 @@ Future _resolveInstanceRefForPath( map: (parent) { final keyPath = path.pathToProperty.last as MapKeyPath; final key = keyPath.ref == null ? 'null' : 'key'; + final keyPathRef = keyPath.ref; return eval.safeEval( 'parent[$key]', isAlive: isAlive, scope: { 'parent': parent.instanceRefId, - if (keyPath.ref != null) 'key': keyPath.ref + if (keyPathRef != null) 'key': keyPathRef, }, ); }, @@ -94,11 +89,10 @@ Future _resolveInstanceRefForPath( ); final ref = field.ref.dataOrThrow; - if (ref == null) return null; // we cannot do `eval('parent.propertyName')` because it is possible for // objects to have multiple properties with the same name - return eval.getInstance(ref, isAlive); + return eval.safeGetInstance(ref, isAlive); }, orElse: () => throw FallThroughError(), ); @@ -112,10 +106,10 @@ Future _resolveInstanceRefForPath( /// fields are both defined in the same library. Future _mutate( String newValueExpression, { - @required InstancePath path, - @required AutoDisposeProviderReference ref, - @required Disposable isAlive, - @required InstanceDetails parent, + required InstancePath path, + required AutoDisposeRef ref, + required Disposable isAlive, + required InstanceDetails parent, }) async { await parent.maybeMap( list: (parent) async { @@ -134,13 +128,14 @@ Future _mutate( final eval = await ref.watch(evalProvider.future); final keyPath = path.pathToProperty.last as MapKeyPath; final keyRefVar = keyPath.ref == null ? 'null' : 'key'; + final keyPathRef = keyPath.ref; return eval.safeEval( 'parent[$keyRefVar] = $newValueExpression', isAlive: isAlive, scope: { 'parent': parent.instanceRefId, - if (keyPath.ref != null) 'key': keyPath.ref, + if (keyPathRef != null) 'key': keyPathRef, }, ); }, @@ -155,7 +150,7 @@ Future _mutate( ); return field.eval.safeEval( - 'parent.${propertyPath.name} = $newValueExpression', + '(parent as ${propertyPath.ownerName}).${propertyPath.name} = $newValueExpression', isAlive: isAlive, scope: { 'parent': parent.instanceRefId, @@ -169,69 +164,67 @@ Future _mutate( // Since the same object can be used in multiple locations at once, we need // to refresh the entire tree instead of just the node that was modified. - unawaited(ref.container.refresh(rawInstanceProvider(path.root))); + ref.refresh(instanceProvider(path.root)); // Forces the UI to rebuild after the state change await serviceManager.performHotReload(); } -Future _resolveParent( - AutoDisposeProviderReference ref, +Future _resolveParent( + AutoDisposeRef ref, InstancePath path, ) async { return path.pathToProperty.isNotEmpty - ? await ref.watch(rawInstanceProvider(path.parent).future) + ? await ref.watch(instanceProvider(path.parent!).future) : null; } -Future _tryParseEnum( +Future _tryParseEnum( Instance instance, { - @required EvalOnDartLibrary eval, - @required Disposable isAlive, - @required String instanceRefId, - @required Setter setter, + required EvalOnDartLibrary eval, + required Disposable isAlive, + required String instanceRefId, + required Setter? setter, }) async { if (instance.kind != InstanceKind.kPlainInstance || - instance.fields.length != 2) return null; + instance.fields?.length != 2) return null; - InstanceRef findPropertyWithName(String name) { + InstanceRef? findPropertyWithName(String name) { return instance.fields - .firstWhereOrNull((element) => element.decl.name == name) + ?.firstWhereOrNull((element) => element.decl?.name == name) ?.value; } final _nameRef = findPropertyWithName('_name'); final indexRef = findPropertyWithName('index'); - if (_nameRef == null || indexRef == null) return null; - final nameInstanceFuture = eval.getInstance(_nameRef, isAlive); - final indexInstanceFuture = eval.getInstance(indexRef, isAlive); + final nameInstanceFuture = eval.safeGetInstance(_nameRef, isAlive); + final indexInstanceFuture = eval.safeGetInstance(indexRef, isAlive); final index = await indexInstanceFuture; - if (index.kind != InstanceKind.kInt) return null; final name = await nameInstanceFuture; if (name.kind != InstanceKind.kString) return null; - final nameSplit = name.valueAsString.split('.'); - - if (nameSplit.length != 2) return null; + // Some Dart versions have for name "EnumType.valueName", others only have "valueName". + // So we have to strip the type manually + final nameSplit = name.valueAsString!.split('.'); return EnumInstance( - type: nameSplit.first, - value: nameSplit[1], + type: instance.classRef!.name!, + value: nameSplit.last, instanceRefId: instanceRefId, setter: setter, ); } -Setter _parseSetter({ - @required InstancePath path, - @required ProviderReference ref, - @required Disposable isAlive, - @required InstanceDetails parent, +Setter? _parseSetter({ + required InstancePath path, + required AutoDisposeRef ref, + required Disposable isAlive, + required InstanceDetails? parent, }) { if (parent == null) return null; @@ -256,8 +249,10 @@ Setter _parseSetter({ // This may edit the wrong property when an object has two properties with // with the same name. // TODO use ownerUri - final field = - parent.fields.firstWhere((field) => field.name == keyPath.name); + final field = parent.fields.firstWhere( + (field) => + field.name == keyPath.name && field.ownerName == keyPath.ownerName, + ); if (field.isFinal) return null; return mutate; @@ -270,7 +265,7 @@ Setter _parseSetter({ /// /// The UI should not be used directly. Instead, use [instanceProvider]. final AutoDisposeFutureProviderFamily - rawInstanceProvider = + instanceProvider = AutoDisposeFutureProviderFamily( (ref, path) async { ref.watch(hotRestartEventProvider); @@ -282,9 +277,7 @@ final AutoDisposeFutureProviderFamily final parent = await _resolveParent(ref, path); - InstanceRef instanceRef; - - instanceRef = await _resolveInstanceRefForPath( + final instanceRef = await _resolveInstanceRefForPath( path, ref: ref, parent: parent, @@ -298,47 +291,47 @@ final AutoDisposeFutureProviderFamily parent: parent, ); - final instance = await eval.getInstance(instanceRef, isAlive); + final instance = await eval.safeGetInstance(instanceRef, isAlive); switch (instance.kind) { case InstanceKind.kNull: return InstanceDetails.nill(setter: setter); case InstanceKind.kBool: return InstanceDetails.boolean( - instance.valueAsString, - instanceRefId: instanceRef.id, + instance.valueAsString!, + instanceRefId: instanceRef.id!, setter: setter, ); case InstanceKind.kInt: case InstanceKind.kDouble: return InstanceDetails.number( - instance.valueAsString, - instanceRefId: instanceRef.id, + instance.valueAsString!, + instanceRefId: instanceRef.id!, setter: setter, ); case InstanceKind.kString: return InstanceDetails.string( - instance.valueAsString, - instanceRefId: instanceRef.id, + instance.valueAsString!, + instanceRefId: instanceRef.id!, setter: setter, ); case InstanceKind.kMap: // voluntarily throw if a key failed to load - final keysRef = instance.associations.map((e) => e.key as InstanceRef); + final keysRef = instance.associations!.map((e) => e.key as InstanceRef); final keysFuture = Future.wait([ for (final keyRef in keysRef) ref.watch( - rawInstanceProvider(InstancePath.fromInstanceId(keyRef?.id)).future, + instanceProvider(InstancePath.fromInstanceId(keyRef.id!)).future, ) ]); return InstanceDetails.map( await keysFuture, hash: await eval.getHashCode(instance, isAlive: isAlive), - instanceRefId: instanceRef.id, + instanceRefId: instanceRef.id!, setter: setter, ); @@ -347,9 +340,9 @@ final AutoDisposeFutureProviderFamily // TODO(rrousselGit): support Type case InstanceKind.kList: return InstanceDetails.list( - length: instance.length, + length: instance.length!, hash: await eval.getHashCode(instance, isAlive: isAlive), - instanceRefId: instanceRef.id, + instanceRefId: instanceRef.id!, setter: setter, ); @@ -359,17 +352,19 @@ final AutoDisposeFutureProviderFamily instance, eval: eval, isAlive: isAlive, - instanceRefId: instanceRef.id, + instanceRefId: instanceRef.id!, setter: setter, ); if (enumDetails != null) return enumDetails; - final classInstance = await eval.getClass(instance.classRef, isAlive); + final classInstance = + await eval.safeGetClass(instance.classRef!, isAlive); final evalForInstance = - ref.watch(libraryEvalProvider(classInstance.library.uri).future); + // TODO(rrousselGit) when can `library` be null? + ref.watch(libraryEvalProvider(classInstance.library!.uri!).future); - final appName = tryParsePackageName(eval.isolate.rootLib.uri); + final appName = tryParsePackageName(eval.isolate!.rootLib!.uri!); final fields = await _parseFields( ref, @@ -383,62 +378,58 @@ final AutoDisposeFutureProviderFamily return InstanceDetails.object( fields.sorted((a, b) => sortFieldsByName(a.name, b.name)), hash: await eval.getHashCode(instance, isAlive: isAlive), - type: instance.classRef.name, - instanceRefId: instanceRef.id, + type: classInstance.name!, + instanceRefId: instanceRef.id!, evalForInstance: await evalForInstance, setter: setter, ); } }); -/// [rawInstanceProvider] but the loading state is debounced for one second. -/// -/// This avoids flickers when a state is refreshed -final instanceProvider = - familyAsyncDebounce, InstancePath>( - rawInstanceProvider, -); - final _packageNameExp = RegExp( r'package:(.+?)/', ); -String tryParsePackageName(String uri) { +String? tryParsePackageName(String uri) { return _packageNameExp.firstMatch(uri)?.group(1); } Future> _parseFields( - AutoDisposeProviderReference ref, + AutoDisposeRef ref, EvalOnDartLibrary eval, Instance instance, Class classInstance, { - @required Disposable isAlive, - @required String appName, + required Disposable isAlive, + required String? appName, }) async { - final fields = instance.fields.map((field) async { - final owner = await eval.getClass(field.decl.owner, isAlive); + final fields = instance.fields!.map((field) async { + final fieldDeclaration = field.decl!; + final owner = + await eval.safeGetClass(fieldDeclaration.owner! as ClassRef, isAlive); String ownerUri; String ownerName; - if (owner.mixin == null) { - ownerUri = owner.library.uri; - ownerName = owner.name; + final ownerMixin = owner.mixin; + if (ownerMixin == null) { + ownerUri = owner.library!.uri!; + ownerName = owner.name!; } else { - final mixinClass = await eval.getClass(owner.mixin.typeClass, isAlive); + final mixinClass = + await eval.safeGetClass(ownerMixin.typeClass!, isAlive); - ownerUri = mixinClass.library.uri; - ownerName = mixinClass.name; + ownerUri = mixinClass.library!.uri!; + ownerName = mixinClass.name!; } final ownerPackageName = tryParsePackageName(ownerUri); return ObjectField( - name: field.decl.name, - isFinal: field.decl.isFinal, + name: fieldDeclaration.name!, + isFinal: fieldDeclaration.isFinal!, ref: parseSentinel(field.value), ownerName: ownerName, ownerUri: ownerUri, - eval: await ref.watch(libraryEvalProvider(owner.library.uri).future), + eval: await ref.watch(libraryEvalProvider(ownerUri).future), isDefinedByDependency: ownerPackageName != appName, ); }).toList(); @@ -448,10 +439,10 @@ Future> _parseFields( final _providerChanged = AutoDisposeStreamProviderFamily((ref, id) async* { - final service = await ref.watch(serviceProvider.last); + final service = await ref.watch(serviceProvider.future); yield* service.onExtensionEvent.where((event) { return event.extensionKind == 'provider:provider_changed' && - event.extensionData.data['id'] == id; + event.extensionData?.data['id'] == id; }); }); diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_viewer.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_viewer.dart index 2c6b54c0243..b9c7691af5e 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_viewer.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_viewer.dart @@ -4,8 +4,6 @@ // TODO(rrousselGit) merge this code with the debugger view -// @dart=2.9 - import 'dart:async'; import 'dart:math' as math; @@ -17,6 +15,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../../primitives/sliver_iterable_child_delegate.dart'; import '../../../shared/eval_on_dart_library.dart'; import '../../../shared/theme.dart'; +// ignore: import_of_legacy_library_into_null_safe import '../../inspector/inspector_text_styles.dart'; import 'instance_details.dart'; import 'instance_providers.dart'; @@ -41,7 +40,7 @@ final estimatedChildCountProvider = int one(InstanceDetails instance) => 1; int expandableEstimatedChildCount(Iterable keys) { - if (!ref.watch(isExpandedProvider(path)).state) { + if (!ref.watch(isExpandedProvider(path))) { return 1; } return keys.fold(1, (acc, element) { @@ -95,11 +94,11 @@ void showErrorSnackBar(BuildContext context, Object error) { ); } -class InstanceViewer extends StatefulWidget { +class InstanceViewer extends ConsumerStatefulWidget { const InstanceViewer({ - Key key, - this.rootPath, - @required this.showInternalProperties, + Key? key, + required this.rootPath, + required this.showInternalProperties, }) : super(key: key); final InstancePath rootPath; @@ -109,7 +108,7 @@ class InstanceViewer extends StatefulWidget { _InstanceViewerState createState() => _InstanceViewerState(); } -class _InstanceViewerState extends State { +class _InstanceViewerState extends ConsumerState { final scrollController = ScrollController(); @override @@ -120,11 +119,12 @@ class _InstanceViewerState extends State { Iterable _buildError( Object error, - StackTrace stackTrace, + StackTrace? stackTrace, InstancePath path, ) { if (error is SentinelException) { - return [Text(error.sentinel.valueAsString)]; + final valueAsString = error.sentinel.valueAsString; + if (valueAsString != null) return [Text(valueAsString)]; } return const [Text('')]; @@ -132,55 +132,54 @@ class _InstanceViewerState extends State { Iterable _buildListViewItems( BuildContext context, - ScopedReader watch, { - @required InstancePath path, + WidgetRef ref, { + required InstancePath path, bool disableExpand = false, }) { - return watch(instanceProvider(path)).when( - loading: () => const [Text('loading...')], - error: (err, stack) => _buildError(err, stack, path), - data: (instance) sync* { - final isExpanded = watch(isExpandedProvider(path)); - yield _buildHeader( - instance, - path: path, - isExpanded: isExpanded, - disableExpand: disableExpand, - ); - - if (isExpanded.state) { - yield* instance.maybeMap( - object: (instance) => _buildObjectItem( - context, - watch, - instance, - path: path, - ), - list: (list) => _buildListItem( - context, - watch, - instance, - path: path, - ), - map: (map) => _buildMapItem( - context, - watch, + return ref.watch(instanceProvider(path)).when( + loading: () => const [Text('loading...')], + error: (err, stack) => _buildError(err, stack, path), + data: (instance) sync* { + final isExpanded = ref.watch(isExpandedProvider(path).state); + yield _buildHeader( instance, path: path, - ), - // string/numbers/bools have no children, but this code can be reached - // when the root of the instance tree (which is always expanded) is such primitive. - orElse: () => const [], - ); - } - }, - ); + isExpanded: isExpanded, + disableExpand: disableExpand, + ); + + if (isExpanded.state) { + yield* instance.maybeMap( + object: (instance) => _buildObjectItem( + context, + ref, + instance, + path: path, + ), + list: (list) => _buildListItem( + context, + ref, + list, + path: path, + ), + map: (map) => _buildMapItem( + context, + ref, + map, + path: path, + ), + // Reaches when the root of the instance tree is a string/numbers/bool/.... + orElse: () => const [], + ); + } + }, + ); } Widget _buildHeader( InstanceDetails instance, { - @required InstancePath path, - StateController isExpanded, + required InstancePath path, + StateController? isExpanded, bool disableExpand = false, }) { return _Expandable( @@ -274,14 +273,14 @@ class _InstanceViewerState extends State { Iterable _buildMapItem( BuildContext context, - ScopedReader watch, + WidgetRef ref, MapInstance instance, { - @required InstancePath path, + required InstancePath path, }) sync* { for (final key in instance.keys) { final value = _buildListViewItems( context, - watch, + ref, path: path.pathForChild(PathToProperty.mapKey(ref: key.instanceRefId)), ); @@ -314,14 +313,14 @@ class _InstanceViewerState extends State { Iterable _buildListItem( BuildContext context, - ScopedReader watch, + WidgetRef ref, ListInstance instance, { - @required InstancePath path, + required InstancePath path, }) sync* { for (var index = 0; index < instance.length; index++) { final children = _buildListViewItems( context, - watch, + ref, path: path.pathForChild(PathToProperty.listIndex(index)), ); @@ -351,9 +350,9 @@ class _InstanceViewerState extends State { Iterable _buildObjectItem( BuildContext context, - ScopedReader watch, + WidgetRef ref, ObjectInstance instance, { - @required InstancePath path, + required InstancePath path, }) sync* { for (final field in instance.fields) { if (!widget.showInternalProperties && @@ -365,7 +364,7 @@ class _InstanceViewerState extends State { final children = _buildListViewItems( context, - watch, + ref, path: path.pathForChild(PathToProperty.fromObjectField(field)), ); @@ -398,49 +397,45 @@ class _InstanceViewerState extends State { @override Widget build(BuildContext context) { - return Consumer( - builder: (context, watch, _) { - return Scrollbar( - thumbVisibility: true, - controller: scrollController, - child: ListView.custom( - controller: scrollController, - // TODO: item height should be based on font size - itemExtent: rowHeight, - padding: const EdgeInsets.symmetric( - vertical: denseSpacing, - horizontal: defaultSpacing, - ), - childrenDelegate: SliverIterableChildDelegate( - _buildListViewItems( - context, - watch, - path: widget.rootPath, - disableExpand: true, - ), - estimatedChildCount: - watch(estimatedChildCountProvider(widget.rootPath)), - ), + return Scrollbar( + thumbVisibility: true, + controller: scrollController, + child: ListView.custom( + controller: scrollController, + // TODO: item height should be based on font size + itemExtent: rowHeight, + padding: const EdgeInsets.symmetric( + vertical: denseSpacing, + horizontal: defaultSpacing, + ), + childrenDelegate: SliverIterableChildDelegate( + _buildListViewItems( + context, + ref, + path: widget.rootPath, + disableExpand: true, ), - ); - }, + estimatedChildCount: + ref.watch(estimatedChildCountProvider(widget.rootPath)), + ), + ), ); } } class _ObjectHeader extends StatelessWidget { const _ObjectHeader({ - Key key, + Key? key, this.type, - @required this.hash, - @required this.meta, - @required this.startToken, - @required this.endToken, + required this.hash, + required this.meta, + required this.startToken, + required this.endToken, }) : super(key: key); - final String type; + final String? type; final int hash; - final String meta; + final String? meta; final String startToken; final String endToken; @@ -471,15 +466,15 @@ class _ObjectHeader extends StatelessWidget { class _EditableField extends StatefulWidget { const _EditableField({ - Key key, - @required this.setter, - @required this.child, - @required this.initialEditString, + Key? key, + required this.setter, + required this.child, + required this.initialEditString, }) : super(key: key); final Widget child; final String initialEditString; - final Future Function(String) setter; + final Future Function(String)? setter; @override _EditableFieldState createState() => _EditableFieldState(); @@ -504,9 +499,7 @@ class _EditableFieldState extends State<_EditableField> { @override Widget build(BuildContext context) { - if (widget.setter == null) { - return widget.child; - } + if (widget.setter == null) return widget.child; final colorScheme = Theme.of(context).colorScheme; @@ -516,9 +509,8 @@ class _EditableFieldState extends State<_EditableField> { focusNode: textFieldFocusNode, onSubmitted: (value) async { try { - if (widget.setter != null) { - await widget.setter(value); - } + final setter = widget.setter; + if (setter != null) await setter(value); } catch (err) { showErrorSnackBar(context, err); } @@ -599,13 +591,13 @@ class _EditableFieldState extends State<_EditableField> { class _Expandable extends StatelessWidget { const _Expandable({ - Key key, - @required this.isExpanded, - @required this.isExpandable, - @required this.title, + Key? key, + required this.isExpanded, + required this.isExpandable, + required this.title, }) : super(key: key); - final StateController isExpanded; + final StateController? isExpanded; final bool isExpandable; final Widget title; @@ -618,6 +610,8 @@ class _Expandable extends StatelessWidget { ); } + final isExpanded = this.isExpanded!; + return GestureDetector( onTap: () => isExpanded.state = !isExpanded.state, behavior: HitTestBehavior.opaque, diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.dart index 24a4619ddff..36ec6432e07 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.dart @@ -2,11 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; -import 'package:vm_service/vm_service.dart' hide SentinelException; +import 'package:vm_service/vm_service.dart' hide SentinelException, Error; import '../../../shared/eval_on_dart_library.dart'; @@ -20,10 +18,10 @@ import 'fake_freezed_annotation.dart'; part 'result.freezed.dart'; @freezed -abstract class Result with _$Result { +class Result with _$Result { Result._(); - factory Result.data(@nullable T value) = _ResultData; - factory Result.error(Object error, [StackTrace stackTrace]) = _ResultError; + factory Result.data(T value) = _ResultData; + factory Result.error(Object error, StackTrace stackTrace) = _ResultError; factory Result.guard(T Function() cb) { try { @@ -57,19 +55,23 @@ abstract class Result with _$Result { T get dataOrThrow { return when( data: (value) => value, - error: (err, stack) { - // ignore: only_throw_errors - throw err; - }, + error: Error.throwWithStackTrace, ); } } -Result parseSentinel(Object value) { - // TODO(rrousselGit) remove condition after migrating to NNBD - if (value == null) return Result.data(null); +Result parseSentinel(Object? value) { if (value is T) return Result.data(value); + if (value == null) { + return Result.error( + ArgumentError( + 'Expected $value to be an instance of $T but received `null`', + ), + StackTrace.current, + ); + } + if (value is Sentinel) { return Result.error( SentinelException(value), diff --git a/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.freezed.dart b/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.freezed.dart index f763b8c6fd7..5463597051f 100644 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.freezed.dart +++ b/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.freezed.dart @@ -1,10 +1,6 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: 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 - -// @dart=2.9 +// 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 part of 'result.dart'; @@ -14,19 +10,20 @@ part of 'result.dart'; T _$identity(T value) => value; +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + /// @nodoc class _$ResultTearOff { const _$ResultTearOff(); -// ignore: unused_element - _ResultData data(@nullable T value) { + _ResultData data(T value) { return _ResultData( value, ); } -// ignore: unused_element - _ResultError error(Object error, [StackTrace stackTrace]) { + _ResultError error(Object error, StackTrace stackTrace) { return _ResultError( error, stackTrace, @@ -35,33 +32,48 @@ class _$ResultTearOff { } /// @nodoc -// ignore: unused_element const $Result = _$ResultTearOff(); /// @nodoc mixin _$Result { @optionalTypeArgs - TResult when({ - @required TResult data(@nullable T value), - @required TResult error(Object error, StackTrace stackTrace), - }); + TResult when({ + required TResult Function(T value) data, + required TResult Function(Object error, StackTrace stackTrace) error, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(T value)? data, + TResult Function(Object error, StackTrace stackTrace)? error, + }) => + throw _privateConstructorUsedError; @optionalTypeArgs - TResult maybeWhen({ - TResult data(@nullable T value), - TResult error(Object error, StackTrace stackTrace), - @required TResult orElse(), - }); + TResult maybeWhen({ + TResult Function(T value)? data, + TResult Function(Object error, StackTrace stackTrace)? error, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; @optionalTypeArgs - TResult map({ - @required TResult data(_ResultData value), - @required TResult error(_ResultError value), - }); + TResult map({ + required TResult Function(_ResultData value) data, + required TResult Function(_ResultError value) error, + }) => + throw _privateConstructorUsedError; @optionalTypeArgs - TResult maybeMap({ - TResult data(_ResultData value), - TResult error(_ResultError value), - @required TResult orElse(), - }); + TResult? mapOrNull({ + TResult Function(_ResultData value)? data, + TResult Function(_ResultError value)? error, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_ResultData value)? data, + TResult Function(_ResultError value)? error, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; } /// @nodoc @@ -84,7 +96,7 @@ abstract class _$ResultDataCopyWith { factory _$ResultDataCopyWith( _ResultData value, $Res Function(_ResultData) then) = __$ResultDataCopyWithImpl; - $Res call({@nullable T value}); + $Res call({T value}); } /// @nodoc @@ -99,38 +111,49 @@ class __$ResultDataCopyWithImpl extends _$ResultCopyWithImpl @override $Res call({ - Object value = freezed, + Object? value = freezed, }) { return _then(_ResultData( - value == freezed ? _value.value : value as T, + value == freezed + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as T, )); } } /// @nodoc -class _$_ResultData extends _ResultData { - _$_ResultData(@nullable this.value) : super._(); + +class _$_ResultData extends _ResultData with DiagnosticableTreeMixin { + _$_ResultData(this.value) : super._(); @override - @nullable final T value; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'Result<$T>.data(value: $value)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'Result<$T>.data')) + ..add(DiagnosticsProperty('value', value)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is _ResultData && - (identical(other.value, value) || - const DeepCollectionEquality().equals(other.value, value))); + (other.runtimeType == runtimeType && + other is _ResultData && + const DeepCollectionEquality().equals(other.value, value)); } @override int get hashCode => - runtimeType.hashCode ^ const DeepCollectionEquality().hash(value); + Object.hash(runtimeType, const DeepCollectionEquality().hash(value)); @JsonKey(ignore: true) @override @@ -139,23 +162,29 @@ class _$_ResultData extends _ResultData { @override @optionalTypeArgs - TResult when({ - @required TResult data(@nullable T value), - @required TResult error(Object error, StackTrace stackTrace), + TResult when({ + required TResult Function(T value) data, + required TResult Function(Object error, StackTrace stackTrace) error, }) { - assert(data != null); - assert(error != null); return data(value); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult data(@nullable T value), - TResult error(Object error, StackTrace stackTrace), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(T value)? data, + TResult Function(Object error, StackTrace stackTrace)? error, + }) { + return data?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T value)? data, + TResult Function(Object error, StackTrace stackTrace)? error, + required TResult orElse(), }) { - assert(orElse != null); if (data != null) { return data(value); } @@ -164,23 +193,29 @@ class _$_ResultData extends _ResultData { @override @optionalTypeArgs - TResult map({ - @required TResult data(_ResultData value), - @required TResult error(_ResultError value), + TResult map({ + required TResult Function(_ResultData value) data, + required TResult Function(_ResultError value) error, }) { - assert(data != null); - assert(error != null); return data(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult data(_ResultData value), - TResult error(_ResultError value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(_ResultData value)? data, + TResult Function(_ResultError value)? error, + }) { + return data?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_ResultData value)? data, + TResult Function(_ResultError value)? error, + required TResult orElse(), }) { - assert(orElse != null); if (data != null) { return data(this); } @@ -189,13 +224,13 @@ class _$_ResultData extends _ResultData { } abstract class _ResultData extends Result { + factory _ResultData(T value) = _$_ResultData; _ResultData._() : super._(); - factory _ResultData(@nullable T value) = _$_ResultData; - @nullable T get value; @JsonKey(ignore: true) - _$ResultDataCopyWith> get copyWith; + _$ResultDataCopyWith> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc @@ -218,21 +253,26 @@ class __$ResultErrorCopyWithImpl extends _$ResultCopyWithImpl @override $Res call({ - Object error = freezed, - Object stackTrace = freezed, + Object? error = freezed, + Object? stackTrace = freezed, }) { return _then(_ResultError( - error == freezed ? _value.error : error, - stackTrace == freezed ? _value.stackTrace : stackTrace as StackTrace, + error == freezed + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as Object, + stackTrace == freezed + ? _value.stackTrace + : stackTrace // ignore: cast_nullable_to_non_nullable + as StackTrace, )); } } /// @nodoc -class _$_ResultError extends _ResultError { - _$_ResultError(this.error, [this.stackTrace]) - : assert(error != null), - super._(); + +class _$_ResultError extends _ResultError with DiagnosticableTreeMixin { + _$_ResultError(this.error, this.stackTrace) : super._(); @override final Object error; @@ -240,26 +280,34 @@ class _$_ResultError extends _ResultError { final StackTrace stackTrace; @override - String toString() { + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { return 'Result<$T>.error(error: $error, stackTrace: $stackTrace)'; } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'Result<$T>.error')) + ..add(DiagnosticsProperty('error', error)) + ..add(DiagnosticsProperty('stackTrace', stackTrace)); + } + @override bool operator ==(dynamic other) { return identical(this, other) || - (other is _ResultError && - (identical(other.error, error) || - const DeepCollectionEquality().equals(other.error, error)) && - (identical(other.stackTrace, stackTrace) || - const DeepCollectionEquality() - .equals(other.stackTrace, stackTrace))); + (other.runtimeType == runtimeType && + other is _ResultError && + const DeepCollectionEquality().equals(other.error, error) && + const DeepCollectionEquality() + .equals(other.stackTrace, stackTrace)); } @override - int get hashCode => - runtimeType.hashCode ^ - const DeepCollectionEquality().hash(error) ^ - const DeepCollectionEquality().hash(stackTrace); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(error), + const DeepCollectionEquality().hash(stackTrace)); @JsonKey(ignore: true) @override @@ -268,23 +316,29 @@ class _$_ResultError extends _ResultError { @override @optionalTypeArgs - TResult when({ - @required TResult data(@nullable T value), - @required TResult error(Object error, StackTrace stackTrace), + TResult when({ + required TResult Function(T value) data, + required TResult Function(Object error, StackTrace stackTrace) error, }) { - assert(data != null); - assert(error != null); return error(this.error, stackTrace); } @override @optionalTypeArgs - TResult maybeWhen({ - TResult data(@nullable T value), - TResult error(Object error, StackTrace stackTrace), - @required TResult orElse(), + TResult? whenOrNull({ + TResult Function(T value)? data, + TResult Function(Object error, StackTrace stackTrace)? error, + }) { + return error?.call(this.error, stackTrace); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T value)? data, + TResult Function(Object error, StackTrace stackTrace)? error, + required TResult orElse(), }) { - assert(orElse != null); if (error != null) { return error(this.error, stackTrace); } @@ -293,23 +347,29 @@ class _$_ResultError extends _ResultError { @override @optionalTypeArgs - TResult map({ - @required TResult data(_ResultData value), - @required TResult error(_ResultError value), + TResult map({ + required TResult Function(_ResultData value) data, + required TResult Function(_ResultError value) error, }) { - assert(data != null); - assert(error != null); return error(this); } @override @optionalTypeArgs - TResult maybeMap({ - TResult data(_ResultData value), - TResult error(_ResultError value), - @required TResult orElse(), + TResult? mapOrNull({ + TResult Function(_ResultData value)? data, + TResult Function(_ResultError value)? error, + }) { + return error?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_ResultData value)? data, + TResult Function(_ResultError value)? error, + required TResult orElse(), }) { - assert(orElse != null); if (error != null) { return error(this); } @@ -318,12 +378,12 @@ class _$_ResultError extends _ResultError { } abstract class _ResultError extends Result { + factory _ResultError(Object error, StackTrace stackTrace) = _$_ResultError; _ResultError._() : super._(); - factory _ResultError(Object error, [StackTrace stackTrace]) = - _$_ResultError; Object get error; StackTrace get stackTrace; @JsonKey(ignore: true) - _$ResultErrorCopyWith> get copyWith; + _$ResultErrorCopyWith> get copyWith => + throw _privateConstructorUsedError; } diff --git a/packages/devtools_app/lib/src/screens/provider/provider_debounce.dart b/packages/devtools_app/lib/src/screens/provider/provider_debounce.dart deleted file mode 100644 index a80a260761a..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/provider_debounce.dart +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// @dart=2.9 - -import 'dart:async'; - -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -import 'instance_viewer/eval.dart'; - -// TODO(rrousselGit) remove once the next Riverpod update is released -AutoDisposeStateNotifierProviderFamily, Listened, Id> - familyAsyncDebounce( - Family> - family, { - Duration duration = const Duration(seconds: 1), -}) { - return AutoDisposeStateNotifierProviderFamily, - Listened, Id>( - (ref, id) { - ref.watch(hotRestartEventProvider); - bool listening = true; - - final controller = StateController( - // It is safe to use `read` here because the provider is immediately listened after - ref.read(family(id)), - ); - - Timer timer; - ref.onDispose(() => timer?.cancel()); - - // TODO(rrousselGit): refactor to use `ref.listen` when available - final sub = ref.container.listen( - family(id), - mayHaveChanged: (sub) { - return Future.microtask(() { - if (ref.mounted && listening) sub.flush(); - }); - }, - didChange: (sub) { - timer?.cancel(); - - final value = sub.read(); - - value.map( - data: (_) => controller.state = value, - error: (_) => controller.state = value, - loading: (_) { - timer = Timer(const Duration(seconds: 1), () { - controller.state = value; - }); - }, - ); - }, - ); - - ref.onDispose(() { - sub.close(); - listening = false; - }); - return controller; - }, - // ignore: invalid_use_of_protected_member - name: family.name == null - ? 'familyDebounced($duration)' - // ignore: invalid_use_of_protected_member - : '${family.name}.debounced($duration)', - ); -} - -// TODO(rrousselGit) remove once the next Riverpod update is released -AutoDisposeStateNotifierProvider, Listened> - asyncDebounce( - AutoDisposeProviderBase provider, { - Duration duration = const Duration(seconds: 1), -}) { - return AutoDisposeStateNotifierProvider, Listened>( - (ref) { - ref.watch(hotRestartEventProvider); - bool listening = true; - - final controller = StateController( - // It is safe to use `read` here because the provider is immediately listened after - ref.read(provider), - ); - - Timer timer; - ref.onDispose(() => timer?.cancel()); - - // TODO(rrousselGit): refactor to use `ref.listen` when available - final sub = ref.container.listen( - provider, - mayHaveChanged: (sub) { - return Future.microtask(() { - if (ref.mounted && listening) sub.flush(); - }); - }, - didChange: (sub) { - timer?.cancel(); - - final value = sub.read(); - - value.map( - data: (_) { - controller.state = value; - }, - error: (_) { - controller.state = value; - }, - loading: (_) { - timer = Timer(const Duration(seconds: 1), () { - controller.state = value; - }); - }, - ); - }, - ); - - ref.onDispose(() { - sub.close(); - listening = false; - }); - - return controller; - }, - name: provider.name == null - ? 'debounced($duration)' - : '${provider.name}.debounced($duration)', - ); -} diff --git a/packages/devtools_app/lib/src/screens/provider/provider_list.dart b/packages/devtools_app/lib/src/screens/provider/provider_list.dart index aadb54a54a0..35dfcad45c3 100644 --- a/packages/devtools_app/lib/src/screens/provider/provider_list.dart +++ b/packages/devtools_app/lib/src/screens/provider/provider_list.dart @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../shared/theme.dart'; +// ignore: import_of_legacy_library_into_null_safe import '../inspector/inspector_tree.dart'; import 'provider_nodes.dart'; @@ -18,17 +17,16 @@ const _tilePadding = EdgeInsets.only( bottom: densePadding, ); -final AutoDisposeStateNotifierProvider, String> +final AutoDisposeStateNotifierProvider, String?> selectedProviderIdProvider = - AutoDisposeStateNotifierProvider, String>( + AutoDisposeStateNotifierProvider, String?>( (ref) { - final controller = StateController(null); - final providerIdsNotifier = ref.watch(sortedProviderNodesProvider.notifier); + final controller = StateController(null); - // TODO(rrousselGit): refactor to `ref.listen` when available - ref.onDispose( - providerIdsNotifier.addListener((asyncValue) { - final nodes = asyncValue.data?.value; + ref.listen>>( + sortedProviderNodesProvider, + (prev, value) { + final nodes = value.asData?.value; if (nodes == null) return; if (controller.state == null) { @@ -44,7 +42,8 @@ final AutoDisposeStateNotifierProvider, String> else if (!nodes.any((node) => node.id == controller.state)) { controller.state = nodes.first.id; } - }), + }, + fireImmediately: true, ); return controller; @@ -52,14 +51,14 @@ final AutoDisposeStateNotifierProvider, String> name: 'selectedProviderIdProvider', ); -class ProviderList extends StatefulWidget { - const ProviderList({Key key}) : super(key: key); +class ProviderList extends ConsumerStatefulWidget { + const ProviderList({Key? key}) : super(key: key); @override _ProviderListState createState() => _ProviderListState(); } -class _ProviderListState extends State { +class _ProviderListState extends ConsumerState { final scrollController = ScrollController(); @override @@ -70,34 +69,30 @@ class _ProviderListState extends State { @override Widget build(BuildContext context) { - return Consumer( - builder: (context, watch, child) { - final nodes = watch(sortedProviderNodesProvider); - - return nodes.when( - loading: () => const Center(child: CircularProgressIndicator()), - error: (err, stack) => const Padding( - padding: _tilePadding, - child: Text(''), + final nodes = ref.watch(sortedProviderNodesProvider); + + return nodes.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (err, stack) => const Padding( + padding: _tilePadding, + child: Text(''), + ), + data: (nodes) { + return Scrollbar( + controller: scrollController, + thumbVisibility: true, + child: ListView.builder( + primary: false, + controller: scrollController, + itemCount: nodes.length, + itemBuilder: (context, index) { + final node = nodes[index]; + return ProviderNodeItem( + key: Key('provider-${node.id}'), + node: node, + ); + }, ), - data: (nodes) { - return Scrollbar( - controller: scrollController, - thumbVisibility: true, - child: ListView.builder( - primary: false, - controller: scrollController, - itemCount: nodes.length, - itemBuilder: (context, index) { - final node = nodes[index]; - return ProviderNodeItem( - key: Key('provider-${node.id}'), - node: node, - ); - }, - ), - ); - }, ); }, ); @@ -106,15 +101,15 @@ class _ProviderListState extends State { class ProviderNodeItem extends ConsumerWidget { const ProviderNodeItem({ - Key key, - @required this.node, + Key? key, + required this.node, }) : super(key: key); final ProviderNode node; @override - Widget build(BuildContext context, ScopedReader watch) { - final isSelected = watch(selectedProviderIdProvider) == node.id; + Widget build(BuildContext context, WidgetRef ref) { + final isSelected = ref.watch(selectedProviderIdProvider) == node.id; final colorScheme = Theme.of(context).colorScheme; final backgroundColor = @@ -123,7 +118,7 @@ class ProviderNodeItem extends ConsumerWidget { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - context.read(selectedProviderIdProvider.notifier).state = node.id; + ref.read(selectedProviderIdProvider.notifier).state = node.id; }, child: Container( color: backgroundColor, diff --git a/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart b/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart index f9ccbbd2bf5..c323c49616c 100644 --- a/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart +++ b/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - import 'dart:async'; import 'package:flutter/foundation.dart'; @@ -12,13 +10,12 @@ import 'package:vm_service/vm_service.dart'; import '../../shared/eval_on_dart_library.dart'; import 'instance_viewer/eval.dart'; -import 'provider_debounce.dart'; @immutable class ProviderNode { const ProviderNode({ - @required this.id, - @required this.type, + required this.id, + required this.type, }); final String id; @@ -26,7 +23,7 @@ class ProviderNode { } final _providerListChanged = AutoDisposeStreamProvider((ref) async* { - final service = await ref.watch(serviceProvider.last); + final service = await ref.watch(serviceProvider.future); yield* service.onExtensionEvent.where((event) { return event.extensionKind == 'provider:provider_list_changed'; @@ -51,12 +48,12 @@ final _rawProviderIdsProvider = AutoDisposeFutureProvider>( ); final providerIdInstances = await Future.wait([ - for (final idRef in providerIdRefs.elements.cast()) - eval.getInstance(idRef, isAlive) + for (final idRef in providerIdRefs.elements!.cast()) + eval.safeGetInstance(idRef, isAlive) ]); return [ - for (final idInstance in providerIdInstances) idInstance.valueAsString, + for (final idInstance in providerIdInstances) idInstance.valueAsString!, ]; }, name: '_rawProviderIdsProvider', @@ -79,9 +76,10 @@ final _rawProviderNodeProvider = ); Future getFieldWithName(String name) { - return eval.getInstance( - providerNodeInstance.fields.firstWhere((e) => e.decl.name == name).value - as InstanceRef, + return eval.safeGetInstance( + providerNodeInstance.fields! + .firstWhere((e) => e.decl?.name == name) + .value as InstanceRef, isAlive, ); } @@ -90,7 +88,7 @@ final _rawProviderNodeProvider = return ProviderNode( id: id, - type: type.valueAsString, + type: type.valueAsString!, ); }, name: '_rawProviderNodeProvider', @@ -98,7 +96,7 @@ final _rawProviderNodeProvider = /// Combines [providerIdsProvider] with [providerNodeProvider] to obtain all /// the [ProviderNode]s at once, sorted alphabetically. -final rawSortedProviderNodesProvider = +final sortedProviderNodesProvider = AutoDisposeFutureProvider>((ref) async { final ids = await ref.watch(_rawProviderIdsProvider.future); @@ -108,9 +106,3 @@ final rawSortedProviderNodesProvider = return nodes.toList()..sort((a, b) => a.type.compareTo(b.type)); }); - -// // TODO(rrousselGit) refactor to use "debounce" when available -final sortedProviderNodesProvider = - asyncDebounce>>( - rawSortedProviderNodesProvider, -); diff --git a/packages/devtools_app/lib/src/screens/provider/provider_screen.dart b/packages/devtools_app/lib/src/screens/provider/provider_screen.dart index 74a517a1365..7f01d37704c 100644 --- a/packages/devtools_app/lib/src/screens/provider/provider_screen.dart +++ b/packages/devtools_app/lib/src/screens/provider/provider_screen.dart @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - +import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:provider/provider.dart' as provider show Provider; @@ -28,18 +27,17 @@ final _hasErrorProvider = Provider.autoDispose((ref) { if (selectedProviderId == null) return false; final instance = ref.watch( - rawInstanceProvider(InstancePath.fromProviderId(selectedProviderId)), + instanceProvider(InstancePath.fromProviderId(selectedProviderId)), ); return instance is AsyncError; }); -final _selectedProviderNode = AutoDisposeProvider((ref) { +final _selectedProviderNode = AutoDisposeProvider((ref) { final selectedId = ref.watch(selectedProviderIdProvider); - return ref.watch(sortedProviderNodesProvider).data?.value?.firstWhere( + return ref.watch(sortedProviderNodesProvider).asData?.value.firstWhereOrNull( (node) => node.id == selectedId, - orElse: () => null, ); }); @@ -64,7 +62,7 @@ class ProviderScreen extends Screen { } class ProviderScreenWrapper extends StatefulWidget { - const ProviderScreenWrapper({Key key}) : super(key: key); + const ProviderScreenWrapper({Key? key}) : super(key: key); @override _ProviderScreenWrapperState createState() => _ProviderScreenWrapperState(); @@ -84,69 +82,68 @@ class _ProviderScreenWrapperState extends State { } class ProviderScreenBody extends ConsumerWidget { - const ProviderScreenBody({Key key}) : super(key: key); + const ProviderScreenBody({Key? key}) : super(key: key); @override - Widget build(BuildContext context, ScopedReader watch) { + Widget build(BuildContext context, WidgetRef ref) { final splitAxis = Split.axisFor(context, 0.85); // A provider will automatically be selected as soon as one is detected - final selectedProviderId = watch(selectedProviderIdProvider); + final selectedProviderId = ref.watch(selectedProviderIdProvider); final detailsTitleText = selectedProviderId != null - ? watch(_selectedProviderNode)?.type ?? '' + ? ref.watch(_selectedProviderNode)?.type ?? '' : '[No provider selected]'; - return ProviderListener( - provider: _hasErrorProvider, - onChange: (context, hasError) { - if (hasError) showProviderErrorBanner(context); - }, - child: Split( - axis: splitAxis, - initialFractions: const [0.33, 0.67], - children: [ - OutlineDecoration( - child: Column( - children: const [ - AreaPaneHeader( - needsTopBorder: false, - title: Text('Providers'), - ), + + ref.listen(_hasErrorProvider, (_, hasError) { + if (hasError) showProviderErrorBanner(context); + }); + + return Split( + axis: splitAxis, + initialFractions: const [0.33, 0.67], + children: [ + OutlineDecoration( + child: Column( + children: const [ + AreaPaneHeader( + needsTopBorder: false, + title: Text('Providers'), + ), + Expanded( + child: ProviderList(), + ), + ], + ), + ), + OutlineDecoration( + child: Column( + children: [ + AreaPaneHeader( + needsTopBorder: false, + title: Text(detailsTitleText), + rightActions: [ + SettingsOutlinedButton( + onPressed: () { + showDialog( + context: context, + builder: (_) => _StateInspectorSettingsDialog(), + ); + }, + label: _StateInspectorSettingsDialog.title, + ), + ], + ), + if (selectedProviderId != null) Expanded( - child: ProviderList(), - ), - ], - ), + child: InstanceViewer( + rootPath: InstancePath.fromProviderId(selectedProviderId), + showInternalProperties: ref.watch(_showInternals), + ), + ) + ], ), - OutlineDecoration( - child: Column( - children: [ - AreaPaneHeader( - needsTopBorder: false, - title: Text(detailsTitleText), - rightActions: [ - SettingsOutlinedButton( - onPressed: () { - showDialog( - context: context, - builder: (_) => _StateInspectorSettingsDialog(), - ); - }, - label: _StateInspectorSettingsDialog.title, - ), - ], - ), - if (selectedProviderId != null) - Expanded( - child: InstanceViewer( - rootPath: InstancePath.fromProviderId(selectedProviderId), - showInternalProperties: watch(_showInternals).state, - ), - ) - ], - ), - ) - ], - ), + ) + ], ); } } @@ -165,7 +162,7 @@ class _StateInspectorSettingsDialog extends ConsumerWidget { static const title = 'State inspector configurations'; @override - Widget build(BuildContext context, ScopedReader watch) { + Widget build(BuildContext context, WidgetRef ref) { final theme = Theme.of(context); return DevToolsDialog( @@ -175,12 +172,15 @@ class _StateInspectorSettingsDialog extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: () => _toggleShowInternals(context), + onTap: () => + ref.read(_showInternals.notifier).update((state) => !state), child: Row( children: [ Checkbox( - value: watch(_showInternals).state, - onChanged: (_) => _toggleShowInternals(context), + value: ref.watch(_showInternals), + onChanged: (_) => ref + .read(_showInternals.notifier) + .update((state) => !state), ), const Text( 'Show private properties inherited from SDKs/packages', @@ -195,9 +195,4 @@ class _StateInspectorSettingsDialog extends ConsumerWidget { ], ); } - - void _toggleShowInternals(BuildContext context) { - final showInternals = context.read(_showInternals); - showInternals.state = !showInternals.state; - } } diff --git a/packages/devtools_app/lib/src/screens/provider/riverpod_error_logger_observer.dart b/packages/devtools_app/lib/src/screens/provider/riverpod_error_logger_observer.dart index 6141a38c7fb..6d289fc907a 100644 --- a/packages/devtools_app/lib/src/screens/provider/riverpod_error_logger_observer.dart +++ b/packages/devtools_app/lib/src/screens/provider/riverpod_error_logger_observer.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../config_specific/logger/logger.dart'; @@ -13,22 +11,32 @@ class ErrorLoggerObserver extends ProviderObserver { const ErrorLoggerObserver(); @override - void didAddProvider(ProviderBase provider, Object value) { + void didAddProvider( + ProviderBase provider, + Object? value, + ProviderContainer container, + ) { _maybeLogError(provider, value); } @override - void didUpdateProvider(ProviderBase provider, Object newValue) { + void didUpdateProvider( + ProviderBase provider, + Object? previousValue, + Object? newValue, + ProviderContainer container, + ) { _maybeLogError(provider, newValue); } - void _maybeLogError(ProviderBase provider, Object value) { + void _maybeLogError(ProviderBase provider, Object? value) { if (value is AsyncError) { if (value.error is SentinelException) return; log('Provider $provider failed with "${value.error}"', LogLevel.error); - if (value.stackTrace != null) { - log(value.stackTrace); + final stackTrace = value.stackTrace; + if (stackTrace != null) { + log(stackTrace); } } } diff --git a/packages/devtools_app/lib/src/shared/eval_on_dart_library.dart b/packages/devtools_app/lib/src/shared/eval_on_dart_library.dart index 16eaca6f0a8..8f6cee3e92a 100644 --- a/packages/devtools_app/lib/src/shared/eval_on_dart_library.dart +++ b/packages/devtools_app/lib/src/shared/eval_on_dart_library.dart @@ -269,6 +269,23 @@ class EvalOnDartLibrary extends DisposableController log(stack.toString(), LogLevel.error); } + T _verifySaneValue(T? value, Disposable? isAlive) { + /// Throwing when the request is cancelled instead of returning `null` + /// allows easily chaining eval calls, without having to check "disposed" + /// between each request. + /// It also removes the need for using `!` once the devtool is migrated to NNBD + if (isAlive?.disposed ?? true) { + // throw before _handleError as we don't want to log cancellations. + throw CancelledException(); + } + + if (value == null) { + throw StateError('Expected an instance of $T but received null'); + } + + return value; + } + Future getLibrary(LibraryRef instance, Disposable isAlive) { return getObjHelper(instance, isAlive); } @@ -277,6 +294,11 @@ class EvalOnDartLibrary extends DisposableController return getObjHelper(instance, isAlive); } + Future safeGetClass(ClassRef instance, Disposable isAlive) async { + final value = await getObjHelper(instance, isAlive); + return _verifySaneValue(value, isAlive); + } + Future getFunc(FuncRef instance, Disposable isAlive) { return getObjHelper(instance, isAlive); } @@ -288,29 +310,40 @@ class EvalOnDartLibrary extends DisposableController return await getObjHelper(await instanceRefFuture, isAlive); } - Future getHashCode( + Future safeGetInstance( + FutureOr instanceRefFuture, + Disposable? isAlive, + ) async { + final instanceRef = await instanceRefFuture; + final value = await getObjHelper(instanceRef, isAlive); + return _verifySaneValue(value, isAlive); + } + + Future getHashCode( InstanceRef instance, { required Disposable? isAlive, }) async { // identityHashCode will be -1 if the Flutter SDK is not recent enough - if (instance.identityHashCode != -1) return instance.identityHashCode; + if (instance.identityHashCode != -1 && instance.identityHashCode != null) { + return instance.identityHashCode!; + } - final hash = await (evalInstance( + final hash = await evalInstance( 'instance.hashCode', isAlive: isAlive, scope: {'instance': instance.id!}, - ) as FutureOr); + ); return int.parse(hash.valueAsString!); } /// Eval an expression and immediately obtain its [Instance]. - Future evalInstance( + Future evalInstance( String expression, { required Disposable? isAlive, Map? scope, - }) async { - return getInstance( + }) { + return safeGetInstance( // This is safe to do because `safeEval` will throw instead of returning `null` // when the request is cancelled, so `getInstance` will not receive `null` // as parameter. @@ -410,7 +443,7 @@ class EvalOnDartLibrary extends DisposableController await future; - final resultRef = await (evalInstance( + final resultRef = await evalInstance( '() {' ' final result = widgetInspectorService.toObject("$readerId", "$readerGroup") as List;' ' widgetInspectorService.disposeGroup("$readerGroup");' @@ -418,7 +451,7 @@ class EvalOnDartLibrary extends DisposableController '}()', isAlive: isAlive, scope: {'widgetInspectorService': widgetInspectorServiceRef.id!}, - ) as FutureOr); + ); assert(resultRef.length == 1 || resultRef.length == 2); if (resultRef.length == 2) { @@ -490,7 +523,7 @@ class EvalOnDartLibrary extends DisposableController /// It also removes the need for using `!` once the devtool is migrated to NNBD if (isAlive?.disposed ?? true) { // throw before _handleError as we don't want to log cancellations. - throw CancelledException('safeEval'); + throw CancelledException(); } _handleError(err, stack); @@ -616,16 +649,7 @@ class FutureFailedException implements Exception { } } -class CancelledException implements Exception { - CancelledException(this.operationName); - - final String operationName; - - @override - String toString() { - return 'The operation $operationName was cancelled'; - } -} +class CancelledException implements Exception {} class UnknownEvalException implements Exception { UnknownEvalException({ diff --git a/packages/devtools_app/pubspec.yaml b/packages/devtools_app/pubspec.yaml index 71357c930ac..ca97ace44dc 100644 --- a/packages/devtools_app/pubspec.yaml +++ b/packages/devtools_app/pubspec.yaml @@ -8,7 +8,7 @@ version: 2.12.2 homepage: https://github.com/flutter/devtools environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' # The flutter desktop support interacts with build scripts on the Flutter # side that are not yet stable, so it requires a very recent version of # Flutter. This version will increase regularly as the build scripts change. @@ -35,7 +35,7 @@ dependencies: flutter: sdk: flutter flutter_markdown: ^0.6.8 - flutter_riverpod: ^0.14.0+3 + flutter_riverpod: ^2.0.0-dev.5 flutter_web_plugins: sdk: flutter http: ^0.13.4 diff --git a/packages/devtools_app/test/fixtures/riverpod_app/lib/main.dart b/packages/devtools_app/test/fixtures/riverpod_app/lib/main.dart index 26727927a55..b49080aaaba 100644 --- a/packages/devtools_app/test/fixtures/riverpod_app/lib/main.dart +++ b/packages/devtools_app/test/fixtures/riverpod_app/lib/main.dart @@ -21,11 +21,11 @@ void main() { ); } -final counterProvider = StateNotifierProvider((ref) => Counter()); +final counterProvider = StateNotifierProvider((ref) => Counter()); class MyApp extends ConsumerWidget { @override - Widget build(BuildContext context, ScopedReader watch) { + Widget build(BuildContext context, WidgetRef ref) { return MaterialApp( home: Scaffold( appBar: AppBar( @@ -37,7 +37,7 @@ class MyApp extends ConsumerWidget { children: [ const Text('You clicked this many times on the button:'), Text( - watch(counterProvider).toString(), + ref.watch(counterProvider).toString(), style: Theme.of(context).textTheme.headline4, ), ], @@ -45,7 +45,7 @@ class MyApp extends ConsumerWidget { ), floatingActionButton: FloatingActionButton( key: const Key('increment'), - onPressed: () => context.read(counterProvider).increment(), + onPressed: () => ref.read(counterProvider.notifier).increment(), child: const Icon(Icons.add), ), ), diff --git a/packages/devtools_app/test/fixtures/riverpod_app/pubspec.yaml b/packages/devtools_app/test/fixtures/riverpod_app/pubspec.yaml index c7c646d65f7..2ab8335cc0f 100644 --- a/packages/devtools_app/test/fixtures/riverpod_app/pubspec.yaml +++ b/packages/devtools_app/test/fixtures/riverpod_app/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_riverpod: ^0.14.0 + flutter_riverpod: ^2.0.0-dev.5 flutter_test: sdk: flutter diff --git a/packages/devtools_app/test/goldens/instance_viewer/collasped_list.png b/packages/devtools_app/test/goldens/instance_viewer/collasped_list.png index b6bb3d03f45..a2c633cee49 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/collasped_list.png and b/packages/devtools_app/test/goldens/instance_viewer/collasped_list.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/collasped_map.png b/packages/devtools_app/test/goldens/instance_viewer/collasped_map.png index d4273f5f9ff..d8df26db8ed 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/collasped_map.png and b/packages/devtools_app/test/goldens/instance_viewer/collasped_map.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/collasped_object.png b/packages/devtools_app/test/goldens/instance_viewer/collasped_object.png index e280a42994f..dca76702d2b 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/collasped_object.png and b/packages/devtools_app/test/goldens/instance_viewer/collasped_object.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/edit.png b/packages/devtools_app/test/goldens/instance_viewer/edit.png index ae774bd620b..b1fb8ad7709 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/edit.png and b/packages/devtools_app/test/goldens/instance_viewer/edit.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/edit_esc.png b/packages/devtools_app/test/goldens/instance_viewer/edit_esc.png index ec126028ef6..7f683368005 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/edit_esc.png and b/packages/devtools_app/test/goldens/instance_viewer/edit_esc.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/expanded_list.png b/packages/devtools_app/test/goldens/instance_viewer/expanded_list.png index 4f03ea0144a..b92b4651603 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/expanded_list.png and b/packages/devtools_app/test/goldens/instance_viewer/expanded_list.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/expanded_map.png b/packages/devtools_app/test/goldens/instance_viewer/expanded_map.png index 31faec0b98b..eef68e5ece8 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/expanded_map.png and b/packages/devtools_app/test/goldens/instance_viewer/expanded_map.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/expanded_object.png b/packages/devtools_app/test/goldens/instance_viewer/expanded_object.png index 8b8a5da82d9..4b8b5427bf0 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/expanded_object.png and b/packages/devtools_app/test/goldens/instance_viewer/expanded_object.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/loading.png b/packages/devtools_app/test/goldens/instance_viewer/loading.png index 3222a17a6da..600c7322cc5 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/loading.png and b/packages/devtools_app/test/goldens/instance_viewer/loading.png differ diff --git a/packages/devtools_app/test/goldens/instance_viewer/string.png b/packages/devtools_app/test/goldens/instance_viewer/string.png index efd2a5fb12b..7a4fc871501 100644 Binary files a/packages/devtools_app/test/goldens/instance_viewer/string.png and b/packages/devtools_app/test/goldens/instance_viewer/string.png differ diff --git a/packages/devtools_app/test/goldens/provider_screen/list_error_banner.png b/packages/devtools_app/test/goldens/provider_screen/list_error_banner.png index 565e9d7d5fe..1e5e0d24b4d 100644 Binary files a/packages/devtools_app/test/goldens/provider_screen/list_error_banner.png and b/packages/devtools_app/test/goldens/provider_screen/list_error_banner.png differ diff --git a/packages/devtools_app/test/goldens/provider_screen/no_selected_provider.png b/packages/devtools_app/test/goldens/provider_screen/no_selected_provider.png index a47648fbad2..c80fdab32f1 100644 Binary files a/packages/devtools_app/test/goldens/provider_screen/no_selected_provider.png and b/packages/devtools_app/test/goldens/provider_screen/no_selected_provider.png differ diff --git a/packages/devtools_app/test/goldens/provider_screen/selected_provider.png b/packages/devtools_app/test/goldens/provider_screen/selected_provider.png index 8426b4a38c1..86bd5bb6b6d 100644 Binary files a/packages/devtools_app/test/goldens/provider_screen/selected_provider.png and b/packages/devtools_app/test/goldens/provider_screen/selected_provider.png differ diff --git a/packages/devtools_app/test/goldens/provider_screen/selected_provider_error_banner.png b/packages/devtools_app/test/goldens/provider_screen/selected_provider_error_banner.png index faa5682761e..4245c291104 100644 Binary files a/packages/devtools_app/test/goldens/provider_screen/selected_provider_error_banner.png and b/packages/devtools_app/test/goldens/provider_screen/selected_provider_error_banner.png differ diff --git a/packages/devtools_app/test/instance_viewer/instance_viewer_test.dart b/packages/devtools_app/test/instance_viewer/instance_viewer_test.dart index 44ae077da06..c35df9763ee 100644 --- a/packages/devtools_app/test/instance_viewer/instance_viewer_test.dart +++ b/packages/devtools_app/test/instance_viewer/instance_viewer_test.dart @@ -2,26 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: import_of_legacy_library_into_null_safe +// ignore_for_file: avoid_redundant_argument_values, false positive on required nullable parameters, import_of_legacy_library_into_null_safe +import 'package:devtools_app/devtools_app.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_details.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_providers.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_viewer.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/result.dart'; -import 'package:devtools_app/src/service/service_manager.dart'; import 'package:devtools_app/src/shared/eval_on_dart_library.dart'; -import 'package:devtools_app/src/shared/globals.dart'; import 'package:devtools_test/devtools_test.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; -final alwaysExpandedOverride = - isExpandedProvider.overrideWithProvider((ref, param) => true); +final alwaysExpandedOverride = isExpandedProvider + .overrideWithProvider((param) => StateProvider((ref) => true)); -final neverExpandedOverride = - isExpandedProvider.overrideWithProvider((ref, param) => false); +final neverExpandedOverride = isExpandedProvider + .overrideWithProvider((param) => StateProvider((ref) => false)); final emptyObjectInstance = AsyncValue.data( InstanceDetails.object( @@ -35,7 +34,7 @@ final emptyObjectInstance = AsyncValue.data( ); final object2Instance = AsyncValue.data( - ObjectInstance( + InstanceDetails.object( [ ObjectField( name: 'first', @@ -43,7 +42,7 @@ final object2Instance = AsyncValue.data( ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: false, ), ObjectField( @@ -52,7 +51,7 @@ final object2Instance = AsyncValue.data( ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: false, ), ], @@ -71,8 +70,8 @@ final emptyMapInstance = AsyncValue.data( final map2Instance = AsyncValue.data( InstanceDetails.map( [ - stringInstance.data!.value, - list2Instance.data!.value, + stringInstance.value!, + list2Instance.value!, ], hash: 0, instanceRefId: '0', @@ -109,7 +108,7 @@ final trueInstance = AsyncValue.data( ); final int42Instance = AsyncValue.data( - NumInstance('42', instanceRefId: '42', setter: null), + InstanceDetails.number('42', instanceRefId: '42', setter: null), ); final enumValueInstance = AsyncValue.data( @@ -125,6 +124,7 @@ void main() { setUpAll(() => loadFonts()); setUp(() { + setGlobal(IdeTheme, getIdeTheme()); setGlobal(ServiceConnectionManager, FakeServiceManager()); }); @@ -147,7 +147,7 @@ void main() { await tester.pumpWidget( ProviderScope( overrides: [ - rawInstanceProvider(objPath).overrideWithValue( + instanceProvider(objPath).overrideWithValue( AsyncValue.data( ObjectInstance( [ @@ -157,7 +157,7 @@ void main() { ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: true, ), ObjectField( @@ -166,7 +166,7 @@ void main() { ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: true, ), ObjectField( @@ -175,7 +175,7 @@ void main() { ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: false, ), ObjectField( @@ -184,7 +184,7 @@ void main() { ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: false, ), ], @@ -196,13 +196,13 @@ void main() { ), ), ), - rawInstanceProvider(pathForProperty('first')) + instanceProvider(pathForProperty('first')) .overrideWithValue(int42Instance), - rawInstanceProvider(pathForProperty('_second')) + instanceProvider(pathForProperty('_second')) .overrideWithValue(int42Instance), - rawInstanceProvider(pathForProperty('third')) + instanceProvider(pathForProperty('third')) .overrideWithValue(int42Instance), - rawInstanceProvider(pathForProperty('_forth')) + instanceProvider(pathForProperty('_forth')) .overrideWithValue(int42Instance), ], child: const MaterialApp( @@ -235,7 +235,7 @@ void main() { await tester.pumpWidget( ProviderScope( overrides: [ - rawInstanceProvider(objPath).overrideWithValue( + instanceProvider(objPath).overrideWithValue( AsyncValue.data( ObjectInstance( [ @@ -245,7 +245,7 @@ void main() { ownerName: '', ownerUri: '', eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error()), + ref: Result.error(Error(), StackTrace.empty), isDefinedByDependency: false, ), ], @@ -257,7 +257,7 @@ void main() { ), ), ), - rawInstanceProvider(propertyPath).overrideWithValue( + instanceProvider(propertyPath).overrideWithValue( AsyncValue.data( InstanceDetails.number( '0', @@ -305,7 +305,7 @@ void main() { await tester.pumpWidget( ProviderScope( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) + instanceProvider(const InstancePath.fromInstanceId('0')) .overrideWithValue(const AsyncValue.loading()) ], child: const MaterialApp( @@ -327,93 +327,40 @@ void main() { ); }); - testWidgets( - 'once valid data was fetched, going back to loading shows the previous value for 1 second', - (tester) async { - final container = ProviderContainer( - overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesGoldenFile('../goldens/instance_viewer/null.png'), - ); - - container.updateOverrides([ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ]); - - await tester.pump(); - - await expectLater( - find.byType(MaterialApp), - matchesGoldenFile('../goldens/instance_viewer/null.png'), - ); - - await tester.pump(const Duration(seconds: 1)); - - await expectLater( - find.byType(MaterialApp), - matchesGoldenFile('../goldens/instance_viewer/loading.png'), - ); - }); - // TODO(rrousselGit) find a way to test "data then loading then wait then loading then wait shows "loading" after a total of one second" // This is tricky because tester.pump(duration) completes the Timer even if the duration is < 1 second testWidgets( 'once valid data was fetched, going back to loading and emiting an error immediately updates the UI', (tester) async { - final container = ProviderContainer( - overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], + const app = MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), + ), + ), ); - addTearDown(container.dispose); await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ), + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(nullInstance), + ], + child: app, ), ); - await tester.pumpAndSettle(); - - container.updateOverrides([ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ]); - + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: app, + ), + ); await tester.pump(); await expectLater( @@ -421,11 +368,15 @@ void main() { matchesGoldenFile('../goldens/instance_viewer/null.png'), ); - container.updateOverrides([ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(AsyncValue.error(StateError('test error'))), - ]); - + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(AsyncValue.error(StateError('test error'))), + ], + child: app, + ), + ); await tester.pumpAndSettle(); await expectLater( @@ -437,35 +388,34 @@ void main() { testWidgets( 'once valid data was fetched, going back to loading and emiting a new value immediately updates the UI', (tester) async { - final container = ProviderContainer( - overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], + const app = MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), + ), + ), ); - addTearDown(container.dispose); await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ), + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(nullInstance), + ], + child: app, ), ); - await tester.pumpAndSettle(); - - container.updateOverrides([ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ]); - + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: app, + ), + ); await tester.pump(); await expectLater( @@ -473,11 +423,15 @@ void main() { matchesGoldenFile('../goldens/instance_viewer/null.png'), ); - container.updateOverrides([ - rawInstanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(int42Instance), - ]); - + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(int42Instance), + ], + child: app, + ), + ); await tester.pumpAndSettle(); await expectLater( @@ -489,7 +443,7 @@ void main() { testWidgets('renders enums', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('enum')) + instanceProvider(const InstancePath.fromInstanceId('enum')) .overrideWithValue(enumValueInstance), ], ); @@ -520,7 +474,7 @@ void main() { testWidgets('renders null', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('null')) + instanceProvider(const InstancePath.fromInstanceId('null')) .overrideWithValue(nullInstance), ], ); @@ -551,7 +505,7 @@ void main() { testWidgets('renders bools', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('bool')) + instanceProvider(const InstancePath.fromInstanceId('bool')) .overrideWithValue(trueInstance), ], ); @@ -582,7 +536,7 @@ void main() { testWidgets('renders strings', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('string')) + instanceProvider(const InstancePath.fromInstanceId('string')) .overrideWithValue(stringInstance), ], ); @@ -613,7 +567,7 @@ void main() { testWidgets('renders numbers', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('num')) + instanceProvider(const InstancePath.fromInstanceId('num')) .overrideWithValue(int42Instance), ], ); @@ -644,22 +598,22 @@ void main() { testWidgets('renders maps', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('map')) + instanceProvider(const InstancePath.fromInstanceId('map')) .overrideWithValue(map2Instance), // {'string': 42, [...]: ['string', null]} - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map', pathToProperty: [PathToProperty.mapKey(ref: 'string')], ), ).overrideWithValue(int42Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map', pathToProperty: [PathToProperty.mapKey(ref: 'list2')], ), ).overrideWithValue(list2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map', pathToProperty: [ @@ -668,7 +622,7 @@ void main() { ], ), ).overrideWithValue(stringInstance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map', pathToProperty: [ @@ -709,7 +663,7 @@ void main() { 'map', pathToProperty: [PathToProperty.mapKey(ref: 'list2')], ), - ), + ).notifier, ) .state = true; @@ -724,10 +678,10 @@ void main() { testWidgets('renders objects', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('object')) + instanceProvider(const InstancePath.fromInstanceId('object')) .overrideWithValue(object2Instance), // MyClass(first: 42, second: ['string', null]) - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object', pathToProperty: [ @@ -739,7 +693,7 @@ void main() { ], ), ).overrideWithValue(int42Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object', pathToProperty: [ @@ -751,7 +705,7 @@ void main() { ], ), ).overrideWithValue(list2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object', pathToProperty: [ @@ -764,7 +718,7 @@ void main() { ], ), ).overrideWithValue(stringInstance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object', pathToProperty: [ @@ -815,7 +769,7 @@ void main() { ), ], ), - ), + ).notifier, ) .state = true; @@ -830,10 +784,10 @@ void main() { testWidgets('renders lists', (tester) async { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('list')) + instanceProvider(const InstancePath.fromInstanceId('list')) .overrideWithValue(list2Instance), // [true, {'string': 42, [...]: null}] - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list', pathToProperty: [ @@ -841,7 +795,7 @@ void main() { ], ), ).overrideWithValue(trueInstance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list', pathToProperty: [ @@ -849,7 +803,7 @@ void main() { ], ), ).overrideWithValue(map2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list', pathToProperty: [ @@ -858,7 +812,7 @@ void main() { ], ), ).overrideWithValue(int42Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list', pathToProperty: [ @@ -899,7 +853,7 @@ void main() { 'list', pathToProperty: [PathToProperty.listIndex(1)], ), - ), + ).notifier, ) .state = true; @@ -915,7 +869,7 @@ void main() { final container = ProviderContainer( overrides: [ neverExpandedOverride, - rawInstanceProvider(const InstancePath.fromInstanceId('list2')) + instanceProvider(const InstancePath.fromInstanceId('list2')) .overrideWithValue(list2Instance), ], ); @@ -938,7 +892,7 @@ void main() { expect( container .readProviderElement( - rawInstanceProvider(const InstancePath.fromInstanceId('list2')), + instanceProvider(const InstancePath.fromInstanceId('list2')), ) .hasListeners, isTrue, @@ -946,7 +900,7 @@ void main() { expect( container .readProviderElement( - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list2', pathToProperty: [PathToProperty.listIndex(0)], @@ -959,7 +913,7 @@ void main() { expect( container .readProviderElement( - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list2', pathToProperty: [PathToProperty.listIndex(1)], @@ -978,15 +932,15 @@ void main() { final container = ProviderContainer( overrides: [ neverExpandedOverride, - rawInstanceProvider(const InstancePath.fromInstanceId('string')) + instanceProvider(const InstancePath.fromInstanceId('string')) .overrideWithValue(stringInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('null')) + instanceProvider(const InstancePath.fromInstanceId('null')) .overrideWithValue(nullInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('bool')) + instanceProvider(const InstancePath.fromInstanceId('bool')) .overrideWithValue(trueInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('num')) + instanceProvider(const InstancePath.fromInstanceId('num')) .overrideWithValue(int42Instance), - rawInstanceProvider(const InstancePath.fromInstanceId('enum')) + instanceProvider(const InstancePath.fromInstanceId('enum')) .overrideWithValue(enumValueInstance), ], ); @@ -1039,15 +993,15 @@ void main() { overrides: [ // force expanded status alwaysExpandedOverride, - rawInstanceProvider(const InstancePath.fromInstanceId('string')) + instanceProvider(const InstancePath.fromInstanceId('string')) .overrideWithValue(stringInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('null')) + instanceProvider(const InstancePath.fromInstanceId('null')) .overrideWithValue(nullInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('bool')) + instanceProvider(const InstancePath.fromInstanceId('bool')) .overrideWithValue(trueInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('num')) + instanceProvider(const InstancePath.fromInstanceId('num')) .overrideWithValue(int42Instance), - rawInstanceProvider(const InstancePath.fromInstanceId('enum')) + instanceProvider(const InstancePath.fromInstanceId('enum')) .overrideWithValue(enumValueInstance), ], ); @@ -1102,9 +1056,9 @@ void main() { final container = ProviderContainer( overrides: [ neverExpandedOverride, - rawInstanceProvider(const InstancePath.fromInstanceId('empty')) + instanceProvider(const InstancePath.fromInstanceId('empty')) .overrideWithValue(emptyListInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('list-2')) + instanceProvider(const InstancePath.fromInstanceId('list-2')) .overrideWithValue(emptyListInstance) ], ); @@ -1131,24 +1085,24 @@ void main() { test('when expanded, recursively traverse the list content', () { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('empty')) + instanceProvider(const InstancePath.fromInstanceId('empty')) .overrideWithValue(emptyListInstance), // ['string', [42, true]] - rawInstanceProvider(const InstancePath.fromInstanceId('list-2')) + instanceProvider(const InstancePath.fromInstanceId('list-2')) .overrideWithValue(list2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list-2', pathToProperty: [PathToProperty.listIndex(0)], ), ).overrideWithValue(stringInstance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list-2', pathToProperty: [PathToProperty.listIndex(1)], ), ).overrideWithValue(list2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list-2', pathToProperty: [ @@ -1157,7 +1111,7 @@ void main() { ], ), ).overrideWithValue(int42Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'list-2', pathToProperty: [ @@ -1197,7 +1151,7 @@ void main() { 'list-2', pathToProperty: [PathToProperty.listIndex(1)], ), - ), + ).notifier, ) .state = true; @@ -1220,9 +1174,9 @@ void main() { final container = ProviderContainer( overrides: [ neverExpandedOverride, - rawInstanceProvider(const InstancePath.fromInstanceId('empty')) + instanceProvider(const InstancePath.fromInstanceId('empty')) .overrideWithValue(emptyMapInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('map-2')) + instanceProvider(const InstancePath.fromInstanceId('map-2')) .overrideWithValue(map2Instance) ], ); @@ -1249,24 +1203,24 @@ void main() { test('when expanded, recursively traverse the map content', () { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('empty')) + instanceProvider(const InstancePath.fromInstanceId('empty')) .overrideWithValue(emptyMapInstance), // {'string': 'string', [...]: [42, true]] - rawInstanceProvider(const InstancePath.fromInstanceId('map-2')) + instanceProvider(const InstancePath.fromInstanceId('map-2')) .overrideWithValue(map2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map-2', pathToProperty: [PathToProperty.mapKey(ref: 'string')], ), ).overrideWithValue(stringInstance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map-2', pathToProperty: [PathToProperty.mapKey(ref: 'list2')], ), ).overrideWithValue(list2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map-2', pathToProperty: [ @@ -1275,7 +1229,7 @@ void main() { ], ), ).overrideWithValue(int42Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'map-2', pathToProperty: [ @@ -1315,7 +1269,7 @@ void main() { 'map-2', pathToProperty: [PathToProperty.mapKey(ref: 'list2')], ), - ), + ).notifier, ) .state = true; @@ -1339,9 +1293,9 @@ void main() { final container = ProviderContainer( overrides: [ neverExpandedOverride, - rawInstanceProvider(const InstancePath.fromInstanceId('empty')) + instanceProvider(const InstancePath.fromInstanceId('empty')) .overrideWithValue(emptyObjectInstance), - rawInstanceProvider(const InstancePath.fromInstanceId('object-2')) + instanceProvider(const InstancePath.fromInstanceId('object-2')) .overrideWithValue(object2Instance) ], ); @@ -1368,12 +1322,12 @@ void main() { test('when expanded, recursively traverse the object content', () { final container = ProviderContainer( overrides: [ - rawInstanceProvider(const InstancePath.fromInstanceId('empty')) + instanceProvider(const InstancePath.fromInstanceId('empty')) .overrideWithValue(emptyObjectInstance), // Class(first: 'string', second: [42, true]) - rawInstanceProvider(const InstancePath.fromInstanceId('object-2')) + instanceProvider(const InstancePath.fromInstanceId('object-2')) .overrideWithValue(object2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object-2', pathToProperty: [ @@ -1385,7 +1339,7 @@ void main() { ], ), ).overrideWithValue(stringInstance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object-2', pathToProperty: [ @@ -1397,7 +1351,7 @@ void main() { ], ), ).overrideWithValue(list2Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object-2', pathToProperty: [ @@ -1410,7 +1364,7 @@ void main() { ], ), ).overrideWithValue(int42Instance), - rawInstanceProvider( + instanceProvider( const InstancePath.fromInstanceId( 'object-2', pathToProperty: [ @@ -1460,7 +1414,7 @@ void main() { ), ], ), - ), + ).notifier, ) .state = true; @@ -1485,14 +1439,20 @@ void main() { expect( container - .read(isExpandedProvider(const InstancePath.fromProviderId('0'))) + .read( + isExpandedProvider(const InstancePath.fromProviderId('0')) + .notifier, + ) .state, isTrue, ); expect( container - .read(isExpandedProvider(const InstancePath.fromInstanceId('0'))) + .read( + isExpandedProvider(const InstancePath.fromInstanceId('0')) + .notifier, + ) .state, isTrue, ); @@ -1510,7 +1470,7 @@ void main() { '0', pathToProperty: [PathToProperty.listIndex(0)], ), - ), + ).notifier, ) .state, isFalse, @@ -1524,7 +1484,7 @@ void main() { '0', pathToProperty: [PathToProperty.listIndex(0)], ), - ), + ).notifier, ) .state, isFalse, diff --git a/packages/devtools_app/test/instance_viewer/show_internal_properties.png b/packages/devtools_app/test/instance_viewer/show_internal_properties.png index 4b40b4fe988..95e5f40852b 100644 Binary files a/packages/devtools_app/test/instance_viewer/show_internal_properties.png and b/packages/devtools_app/test/instance_viewer/show_internal_properties.png differ diff --git a/packages/devtools_app/test/provider/provider_controller_test.dart b/packages/devtools_app/test/provider/provider_controller_test.dart index 9ce996f787c..fbfaf818ce7 100644 --- a/packages/devtools_app/test/provider/provider_controller_test.dart +++ b/packages/devtools_app/test/provider/provider_controller_test.dart @@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: import_of_legacy_library_into_null_safe - +import 'package:devtools_app/src/config_specific/ide_theme/ide_theme.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_details.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_providers.dart'; import 'package:devtools_app/src/screens/provider/provider_nodes.dart'; -// ignore_for_file: implementation_imports, invalid_use_of_visible_for_testing_member, non_constant_identifier_names import 'package:devtools_app/src/shared/eval_on_dart_library.dart'; import 'package:devtools_app/src/shared/globals.dart'; @@ -20,9 +18,10 @@ import '../test_infra/flutter_test_environment.dart'; Future runProviderControllerTests(FlutterTestEnvironment env) async { late EvalOnDartLibrary evalOnDartLibrary; - Disposable? isAlive; + late Disposable isAlive; setUp(() async { + setGlobal(IdeTheme, getIdeTheme()); await env.setupEnvironment( config: const FlutterRunConfiguration(withDebugger: true), ); @@ -36,7 +35,7 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { }); tearDown(() async { - isAlive!.dispose(); + isAlive.dispose(); evalOnDartLibrary.dispose(); await env.tearDownEnvironment(force: true); }); @@ -47,18 +46,21 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { final container = ProviderContainer(); addTearDown(container.dispose); - final providersSub = - container.listen(rawSortedProviderNodesProvider.future); + final providersSub = container.listen( + sortedProviderNodesProvider.future, + (prev, next) {}, + ); final countSub = container.listen( - rawInstanceProvider( + instanceProvider( const InstancePath.fromProviderId('0').pathForChild( const PathToProperty.objectProperty( name: '_count', ownerUri: 'package:provider_app/main.dart', ownerName: 'Counter', ), - )!, + ), ).future, + (prev, next) {}, ); await evalOnDartLibrary.asyncEval( @@ -106,48 +108,57 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ); group('Provider controllers', () { - test('can mutate private properties from mixins', () async { - final container = ProviderContainer(); - addTearDown(container.dispose); + test( + 'can mutate private properties from mixins', + () async { + final container = ProviderContainer(); + addTearDown(container.dispose); - final sub = container.listen( - rawInstanceProvider( - const InstancePath.fromProviderId('0').pathForChild( - const PathToProperty.objectProperty( - name: '_privateMixinProperty', - ownerUri: 'package:provider_app/mixin.dart', - ownerName: 'Mixin', + final sub = container.listen( + instanceProvider( + const InstancePath.fromProviderId('0').pathForChild( + const PathToProperty.objectProperty( + name: '_privateMixinProperty', + ownerUri: 'package:provider_app/mixin.dart', + ownerName: 'Mixin', + ), ), - )!, - ).future, - ); + ).future, + (prev, next) {}, + ); - var instance = await sub.read(); + var instance = await sub.read(); - expect( - instance, - isA().having((e) => e.displayString, 'displayString', '0'), - ); + expect( + instance, + isA() + .having((e) => e.displayString, 'displayString', '0'), + ); - await instance.setter!('42'); + await instance.setter!('42'); - // read the instance again since it should have changed - instance = await sub.read(); + // read the instance again since it should have changed + instance = await sub.read(); - expect( - instance, - isA() - .having((e) => e.displayString, 'displayString', '42'), - ); - }); + expect( + instance, + isA() + .having((e) => e.displayString, 'displayString', '42'), + ); + }, + skip: 'wait https://github.com/dart-lang/sdk/issues/45093 to be fixed', + ); test( - 'rawSortedProviderNodesProvider', + 'sortedProviderNodesProvider', () async { final container = ProviderContainer(); addTearDown(container.dispose); - final sub = container.listen(rawSortedProviderNodesProvider.future); + final sub = container.listen( + sortedProviderNodesProvider.future, + (prev, next) {}, + ); await evalOnDartLibrary.asyncEval( 'await tester.tap(find.byKey(Key("add"))).then((_) => tester.pump())', @@ -180,8 +191,8 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { final counterFuture = container .listen( - rawInstanceProvider(const InstancePath.fromProviderId('0')) - .future, + instanceProvider(const InstancePath.fromProviderId('0')).future, + (prev, next) {}, ) .read(); @@ -197,7 +208,10 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ); final complexFuture = await container - .listen(rawInstanceProvider(complexPath).future) + .listen( + instanceProvider(complexPath).future, + (prev, next) {}, + ) .read(); final complexPropertiesFuture = @@ -205,15 +219,16 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { for (final field in (complexFuture as ObjectInstance).fields) container .listen( - rawInstanceProvider( + instanceProvider( complexPath.pathForChild( PathToProperty.objectProperty( name: field.name, ownerUri: 'package:provider_app/main.dart', ownerName: 'ComplexObject', ), - )!, + ), ).future, + (prev, next) {}, ) .read() .then( @@ -231,7 +246,10 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ); final mapKeys = await container - .listen(rawInstanceProvider(mapPath).future) + .listen( + instanceProvider(mapPath).future, + (prev, next) {}, + ) .read() .then((value) => value as MapInstance); @@ -239,11 +257,12 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { for (final key in mapKeys.keys) container .listen( - rawInstanceProvider( + instanceProvider( mapPath.pathForChild( PathToProperty.mapKey(ref: key.instanceRefId), - )!, + ), ).future, + (prev, next) {}, ) .read() ]); @@ -254,15 +273,16 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ownerUri: 'package:provider_app/main.dart', ownerName: 'ComplexObject', ), - )!; + ); final listItems = Future.wait([ for (var i = 0; i < 6; i++) container .listen( - rawInstanceProvider( - listPath.pathForChild(PathToProperty.listIndex(i))!, + instanceProvider( + listPath.pathForChild(PathToProperty.listIndex(i)), ).future, + (prev, next) {}, ) .read() ]); @@ -270,24 +290,25 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { // Counter.complex.list[4].value final list4valueFuture = container .listen( - rawInstanceProvider( + instanceProvider( listPath - .pathForChild(const PathToProperty.listIndex(4))! + .pathForChild(const PathToProperty.listIndex(4)) .pathForChild( const PathToProperty.objectProperty( name: 'value', ownerUri: 'package:provider_app/main.dart', ownerName: '_SubObject', ), - )!, + ), ).future, + (prev, next) {}, ) .read(); // Counter.complex.plainInstance.value final plainInstanceValueFuture = container .listen( - rawInstanceProvider( + instanceProvider( complexPath .pathForChild( const PathToProperty.objectProperty( @@ -295,15 +316,16 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ownerUri: 'package:provider_app/main.dart', ownerName: 'ComplexObject', ), - )! + ) .pathForChild( const PathToProperty.objectProperty( name: 'value', ownerUri: 'package:provider_app/main.dart', ownerName: '_SubObject', ), - )!, + ), ).future, + (prev, next) {}, ) .read(); @@ -377,7 +399,7 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { .having( (e) => e.isDefinedByDependency, 'isDefinedByDependency', - true, + false, ), ]), ), @@ -550,11 +572,9 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { expect( complexProperties['lateWithInitializer'], - isA().having( - (e) => e.sentinel.kind, - 'sentinel.kind', - SentinelKind.kNotInitialized, - ), + isA() + .having((e) => e.displayString, 'displayString', '21') + .having((e) => e.setter, 'setter', isNotNull), ); expect( @@ -746,9 +766,8 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { final container = ProviderContainer(); addTearDown(container.dispose); - // Counter._count - final counter_countSub = container.listen( - rawInstanceProvider( + final _countSub = container.listen( + instanceProvider( const InstancePath.fromProviderId( '0', pathToProperty: [ @@ -760,10 +779,11 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ], ), ).future, + (prev, next) {}, ); await expectLater( - counter_countSub.read(), + _countSub.read(), completion( isA() .having((e) => e.displayString, 'displayString', '0'), @@ -776,7 +796,7 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ); await expectLater( - counter_countSub.read(), + _countSub.read(), completion( isA() .having((e) => e.displayString, 'displayString', '1'), @@ -824,10 +844,14 @@ Future runProviderControllerTests(FlutterTestEnvironment env) async { ); // wait for the list of providers to be obtained - await container.listen(rawSortedProviderNodesProvider.future).read(); + await container + .listen(sortedProviderNodesProvider.future, (prev, next) {}) + .read(); - final countSub = - container.listen(rawInstanceProvider(countPath).future); + final countSub = container.listen( + instanceProvider(countPath).future, + (prev, next) {}, + ); final instance = await countSub.read(); diff --git a/packages/devtools_app/test/provider/provider_screen_test.dart b/packages/devtools_app/test/provider/provider_screen_test.dart index 49c6cde4007..28af855759f 100644 --- a/packages/devtools_app/test/provider/provider_screen_test.dart +++ b/packages/devtools_app/test/provider/provider_screen_test.dart @@ -4,6 +4,7 @@ // ignore_for_file: import_of_legacy_library_into_null_safe +import 'package:devtools_app/src/config_specific/ide_theme/ide_theme.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_details.dart'; import 'package:devtools_app/src/screens/provider/instance_viewer/instance_providers.dart'; import 'package:devtools_app/src/screens/provider/provider_list.dart'; @@ -28,6 +29,7 @@ void main() { setUpAll(() => loadFonts()); setUp(() { + setGlobal(IdeTheme, getIdeTheme()); setGlobal(ServiceConnectionManager, FakeServiceManager()); }); @@ -50,30 +52,30 @@ void main() { testWidgetsWithWindowSize( 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the list of providers', windowSize, (tester) async { - final container = ProviderContainer( - overrides: [ - rawSortedProviderNodesProvider.overrideWithValue( - const AsyncValue.loading(), - ), - ], - ); - addTearDown(container.dispose); - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, + ProviderScope( + overrides: [ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.loading(), + ), + ], child: providerScreen, ), ); - container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( - AsyncValue.error(StateError('')), + await tester.pumpWidget( + ProviderScope( + overrides: [ + sortedProviderNodesProvider.overrideWithValue( + AsyncValue.error(StateError('')), + ), + ], + child: providerScreen, ), - ]); + ); // wait for the Banner to appear as it is mounted asynchronously - await tester.pumpAndSettle(); + await tester.pump(); await expectLater( find.byType(ProviderScreenBody), @@ -86,19 +88,22 @@ void main() { test('selects the first provider available', () async { final container = ProviderContainer( overrides: [ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.loading(), ), ], ); addTearDown(container.dispose); - final sub = container.listen(selectedProviderIdProvider); + final sub = container.listen( + selectedProviderIdProvider, + (prev, next) {}, + ); expect(sub.read(), isNull); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ProviderNode(id: '1', type: 'Provider'), @@ -106,7 +111,7 @@ void main() { ), ]); - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), '0'); }); @@ -114,22 +119,25 @@ void main() { test('selects the first provider available after an error', () async { final container = ProviderContainer( overrides: [ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( AsyncValue.error(Error()), ), ], ); addTearDown(container.dispose); - final sub = container.listen(selectedProviderIdProvider); + final sub = container.listen( + selectedProviderIdProvider, + (prev, next) {}, + ); // wait for the error to be handled - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), isNull); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ProviderNode(id: '1', type: 'Provider'), @@ -138,7 +146,7 @@ void main() { ]); // wait for the ids update to be handled - await container.pumpAndSettle(exclude: [selectedProviderIdProvider]); + await container.pump(); expect(sub.read(), '0'); }); @@ -148,7 +156,7 @@ void main() { () async { final container = ProviderContainer( overrides: [ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ]), @@ -157,29 +165,28 @@ void main() { ); addTearDown(container.dispose); - final sub = container.listen(selectedProviderIdProvider); - - await container.pumpAndSettle(); + final sub = container.listen( + selectedProviderIdProvider, + (prev, next) {}, + ); expect(sub.read(), '0'); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '1', type: 'Provider'), ]), ), ]); - await container.pumpAndSettle(); - expect(sub.read(), '1'); }); test('Once a provider is selected, further updates are no-op', () async { final container = ProviderContainer( overrides: [ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ]), @@ -188,14 +195,17 @@ void main() { ); addTearDown(container.dispose); - final sub = container.listen(selectedProviderIdProvider); + final sub = container.listen( + selectedProviderIdProvider, + (prev, next) {}, + ); - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), '0'); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( // '0' is no-longer the first provider on purpose const AsyncValue.data([ ProviderNode(id: '1', type: 'Provider'), @@ -204,7 +214,7 @@ void main() { ), ]); - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), '0'); }); @@ -215,7 +225,7 @@ void main() { () async { final container = ProviderContainer( overrides: [ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ]), @@ -224,31 +234,34 @@ void main() { ); addTearDown(container.dispose); - final sub = container.listen(selectedProviderIdProvider); + final sub = container.listen( + selectedProviderIdProvider, + (prev, next) {}, + ); - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), '0'); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([]), ), ]); - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), isNull); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '1', type: 'Provider'), ]), ), ]); - await container.pumpAndSettle(); + await container.pump(); expect(sub.read(), '1'); }); @@ -257,7 +270,7 @@ void main() { group('ProviderList', () { List getOverrides() { return [ - rawInstanceProvider(const InstancePath.fromProviderId('0')) + instanceProvider(const InstancePath.fromProviderId('0')) .overrideWithValue( AsyncValue.data( InstanceDetails.string( @@ -275,7 +288,7 @@ void main() { windowSize, (tester) async { final container = ProviderContainer( overrides: [ - rawSortedProviderNodesProvider + sortedProviderNodesProvider .overrideWithValue(const AsyncValue.loading()), ...getOverrides(), ], @@ -288,9 +301,7 @@ void main() { ), ); - final context = tester.element(find.byType(ProviderScreenBody)); - - expect(context.read(selectedProviderIdProvider), isNull); + expect(container.read(selectedProviderIdProvider), isNull); expect(find.byType(ProviderNodeItem), findsNothing); await expectLater( @@ -301,7 +312,7 @@ void main() { ); container.updateOverrides([ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ProviderNode(id: '1', type: 'Provider'), @@ -310,9 +321,9 @@ void main() { ...getOverrides(), ]); - await tester.pumpAndSettle(); + await tester.pump(); - expect(context.read(selectedProviderIdProvider), '0'); + expect(container.read(selectedProviderIdProvider), '0'); expect(find.byType(ProviderNodeItem), findsNWidgets(2)); expect( find.descendant( @@ -339,7 +350,7 @@ void main() { 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the selected provider', windowSize, (tester) async { final overrides = [ - rawSortedProviderNodesProvider.overrideWithValue( + sortedProviderNodesProvider.overrideWithValue( const AsyncValue.data([ ProviderNode(id: '0', type: 'Provider'), ProviderNode(id: '1', type: 'Provider'), @@ -348,29 +359,30 @@ void main() { ...getOverrides(), ]; - final container = ProviderContainer( - overrides: [ - ...overrides, - rawInstanceProvider(const InstancePath.fromProviderId('0')) - .overrideWithValue(const AsyncValue.loading()) - ], + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...overrides, + instanceProvider(const InstancePath.fromProviderId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: providerScreen, + ), ); - addTearDown(container.dispose); await tester.pumpWidget( - UncontrolledProviderScope( - container: container, + ProviderScope( + overrides: [ + ...overrides, + instanceProvider(const InstancePath.fromProviderId('0')) + .overrideWithValue(AsyncValue.error(Error())), + ], child: providerScreen, ), ); - container.updateOverrides([ - ...overrides, - rawInstanceProvider(const InstancePath.fromProviderId('0')) - .overrideWithValue(AsyncValue.error(Error())) - ]); - - await tester.pumpAndSettle(); + // await for the modal to be mounted as it is rendered asynchronously + await tester.pump(); expect( find.byKey( @@ -388,23 +400,3 @@ void main() { }); }); } - -extension on ProviderContainer { - // TODO(rrousselGit) remove this utility when riverpod v0.15.0 is released - Future pumpAndSettle({ - List exclude = const [], - }) async { - bool hasDirtyProvider() { - return debugProviderElements - // ignore: invalid_use_of_protected_member - .any((e) => e.dirty && !exclude.contains(e.provider)); - } - - while (hasDirtyProvider()) { - for (final element in debugProviderElements) { - element.flush(); - } - await Future(() {}); - } - } -}