diff --git a/packages/devtools_app/lib/initialization.dart b/packages/devtools_app/lib/initialization.dart index 1ab849fb156..9d69ca07d32 100644 --- a/packages/devtools_app/lib/initialization.dart +++ b/packages/devtools_app/lib/initialization.dart @@ -4,14 +4,12 @@ import 'package:devtools_app_shared/utils.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_web_plugins/url_strategy.dart'; import 'src/app.dart'; import 'src/framework/app_error_handling.dart'; import 'src/framework/framework_core.dart'; import 'src/screens/debugger/syntax_highlighter.dart'; -import 'src/screens/provider/riverpod_error_logger_observer.dart'; import 'src/shared/analytics/analytics_controller.dart'; import 'src/shared/config_specific/logger/logger_helpers.dart'; import 'src/shared/feature_flags.dart'; @@ -43,12 +41,9 @@ void runDevTools({ // Run the app. runApp( - ProviderScope( - observers: const [ErrorLoggerObserver()], - child: DevToolsApp( - screens ?? defaultScreens(sampleData: sampleData), - await analyticsController, - ), + DevToolsApp( + screens ?? defaultScreens(sampleData: sampleData), + await analyticsController, ), ); }); diff --git a/packages/devtools_app/lib/src/app.dart b/packages/devtools_app/lib/src/app.dart index 67a9c1948cf..077418c51cd 100644 --- a/packages/devtools_app/lib/src/app.dart +++ b/packages/devtools_app/lib/src/app.dart @@ -304,9 +304,9 @@ class DevToolsAppState extends State with AutoDisposeMixin { scaffold = DevToolsScaffold.withChild( embedMode: embedMode, child: CenteredMessage( - 'No DevTools ' - '${queryParams.hideAllExceptExtensions ? 'extensions' : 'screens'} ' - 'available for your project.', + message: 'No DevTools ' + '${queryParams.hideAllExceptExtensions ? 'extensions' : 'screens'} ' + 'available for your project.', ), ); } else { @@ -426,7 +426,7 @@ class DevToolsAppState extends State with AutoDisposeMixin { builder: (context, child) { if (child == null) { return const CenteredMessage( - 'Uh-oh, something went wrong. Please refresh the page.', + message: 'Uh-oh, something went wrong. Please refresh the page.', ); } return MultiProvider( diff --git a/packages/devtools_app/lib/src/framework/initializer.dart b/packages/devtools_app/lib/src/framework/initializer.dart index e37d503eae3..fd16af6d931 100644 --- a/packages/devtools_app/lib/src/framework/initializer.dart +++ b/packages/devtools_app/lib/src/framework/initializer.dart @@ -79,7 +79,7 @@ class _InitializerState extends State children: [ const Spacer(), CenteredMessage( - _showConnectToNewAppButton + message: _showConnectToNewAppButton ? 'Cannot connect to VM service.' : 'Waiting for VM service connection...', ), diff --git a/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart b/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart index d0c3cf71e5f..037ae701777 100644 --- a/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart +++ b/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart @@ -394,7 +394,7 @@ class _AnalysisViewState extends State valueListenable: controller.processingNotifier, builder: (context, processing, _) { return processing - ? const CenteredMessage(AppSizeScreen.loadingMessage) + ? const CenteredMessage(message: AppSizeScreen.loadingMessage) : Column( children: [ Flexible( @@ -498,7 +498,7 @@ class _DiffViewState extends State valueListenable: controller.processingNotifier, builder: (context, processing, _) { return processing - ? const CenteredMessage(AppSizeScreen.loadingMessage) + ? const CenteredMessage(message: AppSizeScreen.loadingMessage) : Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart index 77cc56e3203..4be5da001ba 100644 --- a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart +++ b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart @@ -97,7 +97,7 @@ class _DeepLinkListViewMainPanel extends StatelessWidget { case PagePhase.noLinks: // TODO(hangyujin): This is just a place holder to add UI. return const CenteredMessage( - 'Your Flutter project has no Links to verify.', + message: 'Your Flutter project has no Links to verify.', ); case PagePhase.analyzeErrorPage: assert(controller.currentAppLinkSettings?.error != null); @@ -125,7 +125,7 @@ class _DeepLinkListViewMainPanel extends StatelessWidget { case PagePhase.validationErrorPage: // TODO(hangyujin): This is just a place holder to add Error handling. - return const CenteredMessage('Error validating domain '); + return const CenteredMessage(message: 'Error validating domain '); } }, ); diff --git a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/flex/flex.dart b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/flex/flex.dart index 2f289eb64b9..42df234e2cc 100644 --- a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/flex/flex.dart +++ b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/flex/flex.dart @@ -441,7 +441,7 @@ class _VisualizeFlexChildrenState extends State { } if (!widget.properties.hasChildren) { - return const CenteredMessage('No Children'); + return const CenteredMessage(message: 'No Children'); } final theme = Theme.of(context); diff --git a/packages/devtools_app/lib/src/screens/inspector_v2/layout_explorer/flex/flex.dart b/packages/devtools_app/lib/src/screens/inspector_v2/layout_explorer/flex/flex.dart index 573d05adcfc..c63b04b882d 100644 --- a/packages/devtools_app/lib/src/screens/inspector_v2/layout_explorer/flex/flex.dart +++ b/packages/devtools_app/lib/src/screens/inspector_v2/layout_explorer/flex/flex.dart @@ -442,7 +442,7 @@ class _VisualizeFlexChildrenState extends State { } if (!widget.properties.hasChildren) { - return const CenteredMessage('No Children'); + return const CenteredMessage(message: 'No Children'); } final theme = Theme.of(context); diff --git a/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/class_details/class_details.dart b/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/class_details/class_details.dart index d55d5fe4bd6..450e73727a5 100644 --- a/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/class_details/class_details.dart +++ b/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/class_details/class_details.dart @@ -30,7 +30,7 @@ class HeapClassDetails extends StatelessWidget { final data = classData; if (data == null) { return const CenteredMessage( - 'Click a table row to see retaining paths here.', + message: 'Click a table row to see retaining paths here.', ); } @@ -45,7 +45,7 @@ class HeapClassDetails extends StatelessWidget { builder: (_, pathData, __) { if (pathData == null) { return const CenteredMessage( - 'Click a table row to see the detailed path.', + message: 'Click a table row to see the detailed path.', ); } diff --git a/packages/devtools_app/lib/src/screens/performance/tabbed_performance_view.dart b/packages/devtools_app/lib/src/screens/performance/tabbed_performance_view.dart index a31717108a0..6adb48ab683 100644 --- a/packages/devtools_app/lib/src/screens/performance/tabbed_performance_view.dart +++ b/packages/devtools_app/lib/src/screens/performance/tabbed_performance_view.dart @@ -136,7 +136,7 @@ class _TabbedPerformanceViewState extends State controller.flutterFramesController.displayRefreshRate, ) : const CenteredMessage( - 'Select a frame above to view analysis data.', + message: 'Select a frame above to view analysis data.', ), ), featureController: null, diff --git a/packages/devtools_app/lib/src/screens/profiler/profiler_status.dart b/packages/devtools_app/lib/src/screens/profiler/profiler_status.dart index 8ec4677e573..beb8ee8a6d0 100644 --- a/packages/devtools_app/lib/src/screens/profiler/profiler_status.dart +++ b/packages/devtools_app/lib/src/screens/profiler/profiler_status.dart @@ -69,7 +69,7 @@ class EmptyProfileView extends StatelessWidget { @override Widget build(BuildContext context) { - return const CenteredMessage('No CPU samples recorded.'); + return const CenteredMessage(message: 'No CPU samples recorded.'); } } 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 deleted file mode 100644 index 2f7cfa4f8cb..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/eval.dart +++ /dev/null @@ -1,74 +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. - -/// A few utilities related to evaluating dart code -library; - -import 'dart:async'; - -import 'package:devtools_app_shared/service.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:vm_service/vm_service.dart'; - -import '../../../service/vm_service_wrapper.dart'; -import '../../../shared/globals.dart'; - -Stream get _serviceConnectionStream => - _serviceConnectionStreamController.stream; -final _serviceConnectionStreamController = - StreamController.broadcast(); -void setServiceConnectionForProviderScreen(VmServiceWrapper service) { - _serviceConnectionStreamController.add(service); -} - -/// Exposes the current VmServiceWrapper. -/// By listening to this provider instead of directly accessing `serviceManager.manager.service`, -/// this ensures that providers reload properly when the devtool is connected -/// to a different application. -final serviceProvider = StreamProvider((ref) async* { - yield serviceConnection.serviceManager.service!; - yield* _serviceConnectionStream; -}); - -/// An [EvalOnDartLibrary] that has access to no specific library in particular -/// -/// Not suitable to be used when evaluating third-party objects, as it would -/// otherwise not be possible to read private properties. -final evalProvider = libraryEvalProvider('dart:io'); - -/// An [EvalOnDartLibrary] that has access to `provider` -final providerEvalProvider = - libraryEvalProvider('package:provider/src/provider.dart'); - -/// An [EvalOnDartLibrary] for custom objects. -final libraryEvalProvider = - FutureProviderFamily((ref, libraryPath) async { - final service = await ref.watch(serviceProvider.future); - - final eval = EvalOnDartLibrary( - libraryPath, - service, - serviceManager: serviceConnection.serviceManager, - ); - ref.onDispose(eval.dispose); - return eval; -}); - -final hotRestartEventProvider = - ChangeNotifierProvider>((ref) { - final selectedIsolateListenable = - serviceConnection.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 deleted file mode 100644 index e27aa470a0d..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/fake_freezed_annotation.dart +++ /dev/null @@ -1,26 +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. - -// This file contains annotations that behaves like package:freezed_annotation. -// This allows using Freezed without having the devtool depend on the package. -// We could instead remove the annotations, but that would make the process of -// updating the generated files tedious. - -const nullable = Object(); -const freezed = Object(); - -class Default { - const Default(Object value); -} - -class Assert { - const Assert(String exp); -} - -class JsonKey { - const JsonKey({ - 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 deleted file mode 100644 index 7857860175f..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.dart +++ /dev/null @@ -1,203 +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. - -import 'package:collection/collection.dart'; -import 'package:devtools_app_shared/service.dart'; -import 'package:flutter/foundation.dart'; -import 'package:vm_service/vm_service.dart'; - -import 'fake_freezed_annotation.dart'; -import 'result.dart'; - -// This part is generated using `package:freezed`, but without the devtool depending -// on the package. -// To update the generated files, temporarily add freezed/freezed_annotation/build_runner -// as dependencies; replace the `fake_freezed_annotation.dart` import with the -// real annotation package, then execute `pub run build_runner build`. -part 'instance_details.freezed.dart'; - -typedef Setter = Future Function(String newValue); - -@freezed -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 String? ref, - }) = MapKeyPath; - - /// Must not depend on [InstanceRef] and its ID, as they may change across - /// re-evaluations of the object. - /// Depending on those would lead to the UI collapsing previously expanded objects - /// because the new path to a property would be different. - /// - /// We can't just rely on the property name either, because in some cases - /// an object can have multiple properties with the same name (private properties - /// defined in different libraries) - const factory PathToProperty.objectProperty({ - required String name, - - /// Path to the class/mixin that defined this property - required String ownerUri, - - /// Name of the class/mixin that defined this property - required String ownerName, - }) = PropertyPath; - - factory PathToProperty.fromObjectField(ObjectField field) { - return PathToProperty.objectProperty( - name: field.name, - ownerUri: field.ownerUri, - ownerName: field.ownerName, - ); - } -} - -@freezed -class ObjectField with _$ObjectField { - factory ObjectField({ - 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, - - /// 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, - }) = _ObjectField; - - ObjectField._(); - - bool get isPrivate => name.startsWith('_'); -} - -@freezed -class InstanceDetails with _$InstanceDetails { - InstanceDetails._(); - - factory InstanceDetails.nill({ - required Setter? setter, - }) = NullInstance; - - factory InstanceDetails.boolean( - String displayString, { - required String instanceRefId, - required Setter? setter, - }) = BoolInstance; - - factory InstanceDetails.number( - String displayString, { - required String instanceRefId, - required Setter? setter, - }) = NumInstance; - - factory InstanceDetails.string( - String displayString, { - required String instanceRefId, - required Setter? setter, - }) = StringInstance; - - factory InstanceDetails.map( - List keys, { - required int hash, - required String instanceRefId, - required Setter? setter, - }) = MapInstance; - - factory InstanceDetails.list({ - 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 Setter? setter, - - /// An [EvalOnDartLibrary] associated with the library of this object - /// - /// This allows to edit private properties. - required EvalOnDartLibrary evalForInstance, - }) = ObjectInstance; - - factory InstanceDetails.enumeration({ - required String type, - required String value, - required Setter? setter, - required String instanceRefId, - }) = EnumInstance; - - bool get isExpandable { - bool falsy(Object _) => false; - - return map( - nill: falsy, - boolean: falsy, - number: falsy, - string: falsy, - enumeration: falsy, - map: (instance) => instance.keys.isNotEmpty, - list: (instance) => instance.length > 0, - 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 -class InstancePath with _$InstancePath { - const InstancePath._(); - - const factory InstancePath.fromInstanceId( - String instanceId, { - @Default([]) List pathToProperty, - }) = _InstancePathFromInstanceId; - - const factory InstancePath.fromProviderId( - String providerId, { - @Default([]) List pathToProperty, - }) = _InstancePathFromProviderId; - - InstancePath get root => copyWith(pathToProperty: []); - - InstancePath? get parent { - if (pathToProperty.isEmpty) return null; - - return copyWith( - pathToProperty: [ - for (var i = 0; i + 1 < pathToProperty.length; i++) pathToProperty[i], - ], - ); - } - - InstancePath pathForChild(PathToProperty property) { - return copyWith( - pathToProperty: [...pathToProperty, property], - ); - } -} 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 deleted file mode 100644 index e28024d16bc..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_details.freezed.dart +++ /dev/null @@ -1,3868 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// 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'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -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(); - - ListIndexPath listIndex(int index) { - return ListIndexPath( - index, - ); - } - - MapKeyPath mapKey({required String? ref}) { - return MapKeyPath( - ref: ref, - ); - } - - PropertyPath objectProperty( - {required String name, - required String ownerUri, - required String ownerName}) { - return PropertyPath( - name: name, - ownerUri: ownerUri, - ownerName: ownerName, - ); - } -} - -/// @nodoc -const $PathToProperty = _$PathToPropertyTearOff(); - -/// @nodoc -mixin _$PathToProperty { - @optionalTypeArgs - 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 -abstract class $PathToPropertyCopyWith<$Res> { - factory $PathToPropertyCopyWith( - PathToProperty value, $Res Function(PathToProperty) then) = - _$PathToPropertyCopyWithImpl<$Res>; -} - -/// @nodoc -class _$PathToPropertyCopyWithImpl<$Res> - implements $PathToPropertyCopyWith<$Res> { - _$PathToPropertyCopyWithImpl(this._value, this._then); - - final PathToProperty _value; - // ignore: unused_field - final $Res Function(PathToProperty) _then; -} - -/// @nodoc -abstract class $ListIndexPathCopyWith<$Res> { - factory $ListIndexPathCopyWith( - ListIndexPath value, $Res Function(ListIndexPath) then) = - _$ListIndexPathCopyWithImpl<$Res>; - $Res call({int index}); -} - -/// @nodoc -class _$ListIndexPathCopyWithImpl<$Res> - extends _$PathToPropertyCopyWithImpl<$Res> - implements $ListIndexPathCopyWith<$Res> { - _$ListIndexPathCopyWithImpl( - ListIndexPath _value, $Res Function(ListIndexPath) _then) - : super(_value, (v) => _then(v as ListIndexPath)); - - @override - ListIndexPath get _value => super._value as ListIndexPath; - - @override - $Res call({ - Object? index = freezed, - }) { - return _then(ListIndexPath( - index == freezed - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc - -class _$ListIndexPath with DiagnosticableTreeMixin implements ListIndexPath { - const _$ListIndexPath(this.index); - - @override - final int index; - - @override - 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.runtimeType == runtimeType && - other is ListIndexPath && - const DeepCollectionEquality().equals(other.index, index)); - } - - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(index)); - - @JsonKey(ignore: true) - @override - $ListIndexPathCopyWith get copyWith => - _$ListIndexPathCopyWithImpl(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(int index) listIndex, - required TResult Function(String? ref) mapKey, - required TResult Function(String name, String ownerUri, String ownerName) - objectProperty, - }) { - return listIndex(index); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (listIndex != null) { - return listIndex(index); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(ListIndexPath value) listIndex, - required TResult Function(MapKeyPath value) mapKey, - required TResult Function(PropertyPath value) objectProperty, - }) { - return listIndex(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (listIndex != null) { - return listIndex(this); - } - return orElse(); - } -} - -abstract class ListIndexPath implements PathToProperty { - const factory ListIndexPath(int index) = _$ListIndexPath; - - int get index; - @JsonKey(ignore: true) - $ListIndexPathCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $MapKeyPathCopyWith<$Res> { - factory $MapKeyPathCopyWith( - MapKeyPath value, $Res Function(MapKeyPath) then) = - _$MapKeyPathCopyWithImpl<$Res>; - $Res call({String? ref}); -} - -/// @nodoc -class _$MapKeyPathCopyWithImpl<$Res> extends _$PathToPropertyCopyWithImpl<$Res> - implements $MapKeyPathCopyWith<$Res> { - _$MapKeyPathCopyWithImpl(MapKeyPath _value, $Res Function(MapKeyPath) _then) - : super(_value, (v) => _then(v as MapKeyPath)); - - @override - MapKeyPath get _value => super._value as MapKeyPath; - - @override - $Res call({ - Object? ref = freezed, - }) { - return _then(MapKeyPath( - ref: ref == freezed - ? _value.ref - : ref // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc - -class _$MapKeyPath with DiagnosticableTreeMixin implements MapKeyPath { - const _$MapKeyPath({required this.ref}); - - @override - final String? ref; - - @override - 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.runtimeType == runtimeType && - other is MapKeyPath && - const DeepCollectionEquality().equals(other.ref, ref)); - } - - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(ref)); - - @JsonKey(ignore: true) - @override - $MapKeyPathCopyWith get copyWith => - _$MapKeyPathCopyWithImpl(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(int index) listIndex, - required TResult Function(String? ref) mapKey, - required TResult Function(String name, String ownerUri, String ownerName) - objectProperty, - }) { - return mapKey(ref); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (mapKey != null) { - return mapKey(ref); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(ListIndexPath value) listIndex, - required TResult Function(MapKeyPath value) mapKey, - required TResult Function(PropertyPath value) objectProperty, - }) { - return mapKey(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (mapKey != null) { - return mapKey(this); - } - return orElse(); - } -} - -abstract class MapKeyPath implements PathToProperty { - const factory MapKeyPath({required String? ref}) = _$MapKeyPath; - - String? get ref; - @JsonKey(ignore: true) - $MapKeyPathCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PropertyPathCopyWith<$Res> { - factory $PropertyPathCopyWith( - PropertyPath value, $Res Function(PropertyPath) then) = - _$PropertyPathCopyWithImpl<$Res>; - $Res call({String name, String ownerUri, String ownerName}); -} - -/// @nodoc -class _$PropertyPathCopyWithImpl<$Res> - extends _$PathToPropertyCopyWithImpl<$Res> - implements $PropertyPathCopyWith<$Res> { - _$PropertyPathCopyWithImpl( - PropertyPath _value, $Res Function(PropertyPath) _then) - : super(_value, (v) => _then(v as PropertyPath)); - - @override - PropertyPath get _value => super._value as PropertyPath; - - @override - $Res call({ - Object? name = freezed, - Object? ownerUri = freezed, - Object? ownerName = freezed, - }) { - return _then(PropertyPath( - 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 with DiagnosticableTreeMixin implements PropertyPath { - const _$PropertyPath( - {required this.name, required this.ownerUri, required this.ownerName}); - - @override - final String name; - @override - - /// Path to the class/mixin that defined this property - final String ownerUri; - @override - - /// Name of the class/mixin that defined this property - final String ownerName; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(name), - const DeepCollectionEquality().hash(ownerUri), - const DeepCollectionEquality().hash(ownerName)); - - @JsonKey(ignore: true) - @override - $PropertyPathCopyWith get copyWith => - _$PropertyPathCopyWithImpl(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(int index) listIndex, - required TResult Function(String? ref) mapKey, - required TResult Function(String name, String ownerUri, String ownerName) - objectProperty, - }) { - return objectProperty(name, ownerUri, ownerName); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (objectProperty != null) { - return objectProperty(name, ownerUri, ownerName); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(ListIndexPath value) listIndex, - required TResult Function(MapKeyPath value) mapKey, - required TResult Function(PropertyPath value) objectProperty, - }) { - return objectProperty(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (objectProperty != null) { - return objectProperty(this); - } - return orElse(); - } -} - -abstract class PropertyPath implements PathToProperty { - const factory PropertyPath( - {required String name, - required String ownerUri, - required String ownerName}) = _$PropertyPath; - - String get name; - - /// Path to the class/mixin that defined this property - String get ownerUri; - - /// Name of the class/mixin that defined this property - String get ownerName; - @JsonKey(ignore: true) - $PropertyPathCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -class _$ObjectFieldTearOff { - const _$ObjectFieldTearOff(); - - _ObjectField call( - {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, - ownerName: ownerName, - ownerUri: ownerUri, - ref: ref, - eval: eval, - isDefinedByDependency: isDefinedByDependency, - ); - } -} - -/// @nodoc -const $ObjectField = _$ObjectFieldTearOff(); - -/// @nodoc -mixin _$ObjectField { - 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 => 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 => throw _privateConstructorUsedError; - - @JsonKey(ignore: true) - $ObjectFieldCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ObjectFieldCopyWith<$Res> { - factory $ObjectFieldCopyWith( - ObjectField value, $Res Function(ObjectField) then) = - _$ObjectFieldCopyWithImpl<$Res>; - $Res call( - {String name, - bool isFinal, - String ownerName, - String ownerUri, - Result ref, - EvalOnDartLibrary eval, - bool isDefinedByDependency}); - - $ResultCopyWith get ref; -} - -/// @nodoc -class _$ObjectFieldCopyWithImpl<$Res> implements $ObjectFieldCopyWith<$Res> { - _$ObjectFieldCopyWithImpl(this._value, this._then); - - final ObjectField _value; - // ignore: unused_field - final $Res Function(ObjectField) _then; - - @override - $Res call({ - 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 // 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 // ignore: cast_nullable_to_non_nullable - as bool, - )); - } - - @override - $ResultCopyWith get ref { - return $ResultCopyWith(_value.ref, (value) { - return _then(_value.copyWith(ref: value)); - }); - } -} - -/// @nodoc -abstract class _$ObjectFieldCopyWith<$Res> - implements $ObjectFieldCopyWith<$Res> { - factory _$ObjectFieldCopyWith( - _ObjectField value, $Res Function(_ObjectField) then) = - __$ObjectFieldCopyWithImpl<$Res>; - @override - $Res call( - {String name, - bool isFinal, - String ownerName, - String ownerUri, - Result ref, - EvalOnDartLibrary eval, - bool isDefinedByDependency}); - - @override - $ResultCopyWith get ref; -} - -/// @nodoc -class __$ObjectFieldCopyWithImpl<$Res> extends _$ObjectFieldCopyWithImpl<$Res> - implements _$ObjectFieldCopyWith<$Res> { - __$ObjectFieldCopyWithImpl( - _ObjectField _value, $Res Function(_ObjectField) _then) - : super(_value, (v) => _then(v as _ObjectField)); - - @override - _ObjectField get _value => super._value as _ObjectField; - - @override - $Res call({ - 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 // 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 // ignore: cast_nullable_to_non_nullable - as bool, - )); - } -} - -/// @nodoc - -class _$_ObjectField extends _ObjectField with DiagnosticableTreeMixin { - _$_ObjectField( - {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; - @override - final bool isFinal; - @override - final String ownerName; - @override - final String ownerUri; - @override - final Result ref; - @override - - /// An [EvalOnDartLibrary] that can access this field from the owner object - final EvalOnDartLibrary eval; - @override - - /// 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. - final bool isDefinedByDependency; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'ObjectField(name: $name, isFinal: $isFinal, ownerName: $ownerName, ownerUri: $ownerUri, ref: $ref, eval: $eval, isDefinedByDependency: $isDefinedByDependency)'; - } - - @override - 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 - 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 - _$ObjectFieldCopyWith<_ObjectField> get copyWith => - __$ObjectFieldCopyWithImpl<_ObjectField>(this, _$identity); -} - -abstract class _ObjectField extends ObjectField { - factory _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; - @override - bool get isFinal; - @override - String get ownerName; - @override - String get ownerUri; - @override - Result get ref; - @override - - /// An [EvalOnDartLibrary] that can access this field from the owner object - EvalOnDartLibrary get eval; - @override - - /// 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; - @override - @JsonKey(ignore: true) - _$ObjectFieldCopyWith<_ObjectField> get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -class _$InstanceDetailsTearOff { - const _$InstanceDetailsTearOff(); - - NullInstance nill({required Setter? setter}) { - return NullInstance( - setter: setter, - ); - } - - BoolInstance boolean(String displayString, - {required String instanceRefId, required Setter? setter}) { - return BoolInstance( - displayString, - instanceRefId: instanceRefId, - setter: setter, - ); - } - - NumInstance number(String displayString, - {required String instanceRefId, required Setter? setter}) { - return NumInstance( - displayString, - instanceRefId: instanceRefId, - setter: setter, - ); - } - - StringInstance string(String displayString, - {required String instanceRefId, required Setter? setter}) { - return StringInstance( - displayString, - instanceRefId: instanceRefId, - setter: setter, - ); - } - - MapInstance map(List keys, - {required int hash, - required String instanceRefId, - required Setter? setter}) { - return MapInstance( - keys, - hash: hash, - instanceRefId: instanceRefId, - setter: setter, - ); - } - - ListInstance list( - {required int length, - required int hash, - required String instanceRefId, - required Setter? setter}) { - return ListInstance( - length: length, - hash: hash, - instanceRefId: instanceRefId, - setter: setter, - ); - } - - ObjectInstance object(List fields, - {required String type, - required int hash, - required String instanceRefId, - required Setter? setter, - required EvalOnDartLibrary evalForInstance}) { - return ObjectInstance( - fields, - type: type, - hash: hash, - instanceRefId: instanceRefId, - setter: setter, - evalForInstance: evalForInstance, - ); - } - - EnumInstance enumeration( - {required String type, - required String value, - required Setter? setter, - required String instanceRefId}) { - return EnumInstance( - type: type, - value: value, - setter: setter, - instanceRefId: instanceRefId, - ); - } -} - -/// @nodoc -const $InstanceDetails = _$InstanceDetailsTearOff(); - -/// @nodoc -mixin _$InstanceDetails { - 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, - 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, - 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 => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $InstanceDetailsCopyWith<$Res> { - factory $InstanceDetailsCopyWith( - InstanceDetails value, $Res Function(InstanceDetails) then) = - _$InstanceDetailsCopyWithImpl<$Res>; - $Res call({Setter? setter}); -} - -/// @nodoc -class _$InstanceDetailsCopyWithImpl<$Res> - implements $InstanceDetailsCopyWith<$Res> { - _$InstanceDetailsCopyWithImpl(this._value, this._then); - - final InstanceDetails _value; - // ignore: unused_field - final $Res Function(InstanceDetails) _then; - - @override - $Res call({ - Object? setter = freezed, - }) { - return _then(_value.copyWith( - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc -abstract class $NullInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $NullInstanceCopyWith( - NullInstance value, $Res Function(NullInstance) then) = - _$NullInstanceCopyWithImpl<$Res>; - @override - $Res call({Setter? setter}); -} - -/// @nodoc -class _$NullInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $NullInstanceCopyWith<$Res> { - _$NullInstanceCopyWithImpl( - NullInstance _value, $Res Function(NullInstance) _then) - : super(_value, (v) => _then(v as NullInstance)); - - @override - NullInstance get _value => super._value as NullInstance; - - @override - $Res call({ - Object? setter = freezed, - }) { - return _then(NullInstance( - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc - -class _$NullInstance extends NullInstance with DiagnosticableTreeMixin { - _$NullInstance({required this.setter}) : super._(); - - @override - final Setter? setter; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'InstanceDetails.nill(setter: $setter)'; - } - - @override - 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.runtimeType == runtimeType && - other is NullInstance && - (identical(other.setter, setter) || other.setter == setter)); - } - - @override - int get hashCode => Object.hash(runtimeType, setter); - - @JsonKey(ignore: true) - @override - $NullInstanceCopyWith get copyWith => - _$NullInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - 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, - 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(setter); - } - return orElse(); - } - - @override - @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, - }) { - return nill(this); - } - - @override - @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, - }) { - 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(), - }) { - if (nill != null) { - return nill(this); - } - return orElse(); - } -} - -abstract class NullInstance extends InstanceDetails { - factory NullInstance({required Setter? setter}) = _$NullInstance; - NullInstance._() : super._(); - - @override - Setter? get setter; - @override - @JsonKey(ignore: true) - $NullInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $BoolInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $BoolInstanceCopyWith( - BoolInstance value, $Res Function(BoolInstance) then) = - _$BoolInstanceCopyWithImpl<$Res>; - @override - $Res call({String displayString, String instanceRefId, Setter? setter}); -} - -/// @nodoc -class _$BoolInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $BoolInstanceCopyWith<$Res> { - _$BoolInstanceCopyWithImpl( - BoolInstance _value, $Res Function(BoolInstance) _then) - : super(_value, (v) => _then(v as BoolInstance)); - - @override - BoolInstance get _value => super._value as BoolInstance; - - @override - $Res call({ - Object? displayString = freezed, - Object? instanceRefId = freezed, - Object? setter = freezed, - }) { - return _then(BoolInstance( - displayString == freezed - ? _value.displayString - : displayString // ignore: cast_nullable_to_non_nullable - as String, - instanceRefId: instanceRefId == freezed - ? _value.instanceRefId - : instanceRefId // ignore: cast_nullable_to_non_nullable - as String, - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc - -class _$BoolInstance extends BoolInstance with DiagnosticableTreeMixin { - _$BoolInstance(this.displayString, - {required this.instanceRefId, required this.setter}) - : super._(); - - @override - final String displayString; - @override - final String instanceRefId; - @override - final Setter? setter; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(displayString), - const DeepCollectionEquality().hash(instanceRefId), - setter); - - @JsonKey(ignore: true) - @override - $BoolInstanceCopyWith get copyWith => - _$BoolInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return boolean(displayString, instanceRefId, 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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return boolean(this); - } - - @override - @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, - }) { - 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(), - }) { - if (boolean != null) { - return boolean(this); - } - return orElse(); - } -} - -abstract class BoolInstance extends InstanceDetails { - factory BoolInstance(String displayString, - {required String instanceRefId, - required Setter? setter}) = _$BoolInstance; - BoolInstance._() : super._(); - - String get displayString; - String get instanceRefId; - @override - Setter? get setter; - @override - @JsonKey(ignore: true) - $BoolInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $NumInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $NumInstanceCopyWith( - NumInstance value, $Res Function(NumInstance) then) = - _$NumInstanceCopyWithImpl<$Res>; - @override - $Res call({String displayString, String instanceRefId, Setter? setter}); -} - -/// @nodoc -class _$NumInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $NumInstanceCopyWith<$Res> { - _$NumInstanceCopyWithImpl( - NumInstance _value, $Res Function(NumInstance) _then) - : super(_value, (v) => _then(v as NumInstance)); - - @override - NumInstance get _value => super._value as NumInstance; - - @override - $Res call({ - Object? displayString = freezed, - Object? instanceRefId = freezed, - Object? setter = freezed, - }) { - return _then(NumInstance( - displayString == freezed - ? _value.displayString - : displayString // ignore: cast_nullable_to_non_nullable - as String, - instanceRefId: instanceRefId == freezed - ? _value.instanceRefId - : instanceRefId // ignore: cast_nullable_to_non_nullable - as String, - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc - -class _$NumInstance extends NumInstance with DiagnosticableTreeMixin { - _$NumInstance(this.displayString, - {required this.instanceRefId, required this.setter}) - : super._(); - - @override - final String displayString; - @override - final String instanceRefId; - @override - final Setter? setter; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(displayString), - const DeepCollectionEquality().hash(instanceRefId), - setter); - - @JsonKey(ignore: true) - @override - $NumInstanceCopyWith get copyWith => - _$NumInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return number(displayString, instanceRefId, 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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return number(this); - } - - @override - @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, - }) { - 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(), - }) { - if (number != null) { - return number(this); - } - return orElse(); - } -} - -abstract class NumInstance extends InstanceDetails { - factory NumInstance(String displayString, - {required String instanceRefId, required Setter? setter}) = _$NumInstance; - NumInstance._() : super._(); - - String get displayString; - String get instanceRefId; - @override - Setter? get setter; - @override - @JsonKey(ignore: true) - $NumInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $StringInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $StringInstanceCopyWith( - StringInstance value, $Res Function(StringInstance) then) = - _$StringInstanceCopyWithImpl<$Res>; - @override - $Res call({String displayString, String instanceRefId, Setter? setter}); -} - -/// @nodoc -class _$StringInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $StringInstanceCopyWith<$Res> { - _$StringInstanceCopyWithImpl( - StringInstance _value, $Res Function(StringInstance) _then) - : super(_value, (v) => _then(v as StringInstance)); - - @override - StringInstance get _value => super._value as StringInstance; - - @override - $Res call({ - Object? displayString = freezed, - Object? instanceRefId = freezed, - Object? setter = freezed, - }) { - return _then(StringInstance( - displayString == freezed - ? _value.displayString - : displayString // ignore: cast_nullable_to_non_nullable - as String, - instanceRefId: instanceRefId == freezed - ? _value.instanceRefId - : instanceRefId // ignore: cast_nullable_to_non_nullable - as String, - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc - -class _$StringInstance extends StringInstance with DiagnosticableTreeMixin { - _$StringInstance(this.displayString, - {required this.instanceRefId, required this.setter}) - : super._(); - - @override - final String displayString; - @override - final String instanceRefId; - @override - final Setter? setter; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(displayString), - const DeepCollectionEquality().hash(instanceRefId), - setter); - - @JsonKey(ignore: true) - @override - $StringInstanceCopyWith get copyWith => - _$StringInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return string(displayString, instanceRefId, 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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return string(this); - } - - @override - @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, - }) { - 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(), - }) { - if (string != null) { - return string(this); - } - return orElse(); - } -} - -abstract class StringInstance extends InstanceDetails { - factory StringInstance(String displayString, - {required String instanceRefId, - required Setter? setter}) = _$StringInstance; - StringInstance._() : super._(); - - String get displayString; - String get instanceRefId; - @override - Setter? get setter; - @override - @JsonKey(ignore: true) - $StringInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $MapInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $MapInstanceCopyWith( - MapInstance value, $Res Function(MapInstance) then) = - _$MapInstanceCopyWithImpl<$Res>; - @override - $Res call( - {List keys, - int hash, - String instanceRefId, - Setter? setter}); -} - -/// @nodoc -class _$MapInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $MapInstanceCopyWith<$Res> { - _$MapInstanceCopyWithImpl( - MapInstance _value, $Res Function(MapInstance) _then) - : super(_value, (v) => _then(v as MapInstance)); - - @override - MapInstance get _value => super._value as MapInstance; - - @override - $Res call({ - Object? keys = freezed, - Object? hash = freezed, - Object? instanceRefId = freezed, - Object? setter = freezed, - }) { - return _then(MapInstance( - 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 // ignore: cast_nullable_to_non_nullable - as String, - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc - -class _$MapInstance extends MapInstance with DiagnosticableTreeMixin { - _$MapInstance(this.keys, - {required this.hash, required this.instanceRefId, required this.setter}) - : super._(); - - @override - final List keys; - @override - final int hash; - @override - final String instanceRefId; - @override - final Setter? setter; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(keys), - const DeepCollectionEquality().hash(hash), - const DeepCollectionEquality().hash(instanceRefId), - setter); - - @JsonKey(ignore: true) - @override - $MapInstanceCopyWith get copyWith => - _$MapInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return map(keys, hash, instanceRefId, 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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return map(this); - } - - @override - @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, - }) { - 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(), - }) { - if (map != null) { - return map(this); - } - return orElse(); - } -} - -abstract class MapInstance extends InstanceDetails { - factory MapInstance(List keys, - {required int hash, - required String instanceRefId, - required Setter? setter}) = _$MapInstance; - MapInstance._() : super._(); - - List get keys; - int get hash; - String get instanceRefId; - @override - Setter? get setter; - @override - @JsonKey(ignore: true) - $MapInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ListInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $ListInstanceCopyWith( - ListInstance value, $Res Function(ListInstance) then) = - _$ListInstanceCopyWithImpl<$Res>; - @override - $Res call({int length, int hash, String instanceRefId, Setter? setter}); -} - -/// @nodoc -class _$ListInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $ListInstanceCopyWith<$Res> { - _$ListInstanceCopyWithImpl( - ListInstance _value, $Res Function(ListInstance) _then) - : super(_value, (v) => _then(v as ListInstance)); - - @override - ListInstance get _value => super._value as ListInstance; - - @override - $Res call({ - Object? length = freezed, - Object? hash = freezed, - Object? instanceRefId = freezed, - Object? setter = freezed, - }) { - return _then(ListInstance( - 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 // ignore: cast_nullable_to_non_nullable - as String, - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - )); - } -} - -/// @nodoc - -class _$ListInstance extends ListInstance with DiagnosticableTreeMixin { - _$ListInstance( - {required this.length, - required this.hash, - required this.instanceRefId, - required this.setter}) - : super._(); - - @override - final int length; - @override - final int hash; - @override - final String instanceRefId; - @override - final Setter? setter; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(length), - const DeepCollectionEquality().hash(hash), - const DeepCollectionEquality().hash(instanceRefId), - setter); - - @JsonKey(ignore: true) - @override - $ListInstanceCopyWith get copyWith => - _$ListInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return list(length, hash, instanceRefId, 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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return list(this); - } - - @override - @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, - }) { - 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(), - }) { - if (list != null) { - return list(this); - } - return orElse(); - } -} - -abstract class ListInstance extends InstanceDetails { - factory ListInstance( - {required int length, - required int hash, - required String instanceRefId, - required Setter? setter}) = _$ListInstance; - ListInstance._() : super._(); - - int get length; - int get hash; - String get instanceRefId; - @override - Setter? get setter; - @override - @JsonKey(ignore: true) - $ListInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ObjectInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $ObjectInstanceCopyWith( - ObjectInstance value, $Res Function(ObjectInstance) then) = - _$ObjectInstanceCopyWithImpl<$Res>; - @override - $Res call( - {List fields, - String type, - int hash, - String instanceRefId, - Setter? setter, - EvalOnDartLibrary evalForInstance}); -} - -/// @nodoc -class _$ObjectInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $ObjectInstanceCopyWith<$Res> { - _$ObjectInstanceCopyWithImpl( - ObjectInstance _value, $Res Function(ObjectInstance) _then) - : super(_value, (v) => _then(v as ObjectInstance)); - - @override - ObjectInstance get _value => super._value as ObjectInstance; - - @override - $Res call({ - 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 // 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 // ignore: cast_nullable_to_non_nullable - as String, - setter: setter == freezed - ? _value.setter - : setter // ignore: cast_nullable_to_non_nullable - as Setter?, - evalForInstance: evalForInstance == freezed - ? _value.evalForInstance - : evalForInstance // ignore: cast_nullable_to_non_nullable - as EvalOnDartLibrary, - )); - } -} - -/// @nodoc - -class _$ObjectInstance extends ObjectInstance with DiagnosticableTreeMixin { - _$ObjectInstance(this.fields, - {required this.type, - required this.hash, - required this.instanceRefId, - required this.setter, - required this.evalForInstance}) - : super._(); - - @override - final List fields; - @override - final String type; - @override - final int hash; - @override - final String instanceRefId; - @override - final Setter? setter; - @override - - /// An [EvalOnDartLibrary] associated with the library of this object - /// - /// This allows to edit private properties. - final EvalOnDartLibrary evalForInstance; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'InstanceDetails.object(fields: $fields, type: $type, hash: $hash, instanceRefId: $instanceRefId, setter: $setter, evalForInstance: $evalForInstance)'; - } - - @override - 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 - 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 - $ObjectInstanceCopyWith get copyWith => - _$ObjectInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return object(fields, type, hash, instanceRefId, setter, evalForInstance); - } - - @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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return object(this); - } - - @override - @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, - }) { - 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(), - }) { - if (object != null) { - return object(this); - } - return orElse(); - } -} - -abstract class ObjectInstance extends InstanceDetails { - factory ObjectInstance(List fields, - {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; - String get instanceRefId; - @override - Setter? get setter; - - /// An [EvalOnDartLibrary] associated with the library of this object - /// - /// This allows to edit private properties. - EvalOnDartLibrary get evalForInstance; - @override - @JsonKey(ignore: true) - $ObjectInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $EnumInstanceCopyWith<$Res> - implements $InstanceDetailsCopyWith<$Res> { - factory $EnumInstanceCopyWith( - EnumInstance value, $Res Function(EnumInstance) then) = - _$EnumInstanceCopyWithImpl<$Res>; - @override - $Res call({String type, String value, Setter? setter, String instanceRefId}); -} - -/// @nodoc -class _$EnumInstanceCopyWithImpl<$Res> - extends _$InstanceDetailsCopyWithImpl<$Res> - implements $EnumInstanceCopyWith<$Res> { - _$EnumInstanceCopyWithImpl( - EnumInstance _value, $Res Function(EnumInstance) _then) - : super(_value, (v) => _then(v as EnumInstance)); - - @override - EnumInstance get _value => super._value as EnumInstance; - - @override - $Res call({ - Object? type = freezed, - Object? value = freezed, - Object? setter = freezed, - Object? instanceRefId = freezed, - }) { - return _then(EnumInstance( - 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 // ignore: cast_nullable_to_non_nullable - as Setter?, - instanceRefId: instanceRefId == freezed - ? _value.instanceRefId - : instanceRefId // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// @nodoc - -class _$EnumInstance extends EnumInstance with DiagnosticableTreeMixin { - _$EnumInstance( - {required this.type, - required this.value, - required this.setter, - required this.instanceRefId}) - : super._(); - - @override - final String type; - @override - final String value; - @override - final Setter? setter; - @override - final String instanceRefId; - - @override - 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.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 => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(type), - const DeepCollectionEquality().hash(value), - setter, - const DeepCollectionEquality().hash(instanceRefId)); - - @JsonKey(ignore: true) - @override - $EnumInstanceCopyWith get copyWith => - _$EnumInstanceCopyWithImpl(this, _$identity); - - @override - @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, - }) { - return enumeration(type, value, setter, instanceRefId); - } - - @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, - 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); - } - return orElse(); - } - - @override - @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, - }) { - return enumeration(this); - } - - @override - @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, - }) { - 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(), - }) { - if (enumeration != null) { - return enumeration(this); - } - return orElse(); - } -} - -abstract class EnumInstance extends InstanceDetails { - factory EnumInstance( - {required String type, - required String value, - required Setter? setter, - required String instanceRefId}) = _$EnumInstance; - EnumInstance._() : super._(); - - String get type; - String get value; - @override - Setter? get setter; - String get instanceRefId; - @override - @JsonKey(ignore: true) - $EnumInstanceCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -class _$InstancePathTearOff { - const _$InstancePathTearOff(); - - _InstancePathFromInstanceId fromInstanceId(String instanceId, - {List pathToProperty = const []}) { - return _InstancePathFromInstanceId( - instanceId, - pathToProperty: pathToProperty, - ); - } - - _InstancePathFromProviderId fromProviderId(String providerId, - {List pathToProperty = const []}) { - return _InstancePathFromProviderId( - providerId, - pathToProperty: pathToProperty, - ); - } -} - -/// @nodoc -const $InstancePath = _$InstancePathTearOff(); - -/// @nodoc -mixin _$InstancePath { - 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 => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $InstancePathCopyWith<$Res> { - factory $InstancePathCopyWith( - InstancePath value, $Res Function(InstancePath) then) = - _$InstancePathCopyWithImpl<$Res>; - $Res call({List pathToProperty}); -} - -/// @nodoc -class _$InstancePathCopyWithImpl<$Res> implements $InstancePathCopyWith<$Res> { - _$InstancePathCopyWithImpl(this._value, this._then); - - final InstancePath _value; - // ignore: unused_field - final $Res Function(InstancePath) _then; - - @override - $Res call({ - Object? pathToProperty = freezed, - }) { - return _then(_value.copyWith( - pathToProperty: pathToProperty == freezed - ? _value.pathToProperty - : pathToProperty // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -abstract class _$InstancePathFromInstanceIdCopyWith<$Res> - implements $InstancePathCopyWith<$Res> { - factory _$InstancePathFromInstanceIdCopyWith( - _InstancePathFromInstanceId value, - $Res Function(_InstancePathFromInstanceId) then) = - __$InstancePathFromInstanceIdCopyWithImpl<$Res>; - @override - $Res call({String instanceId, List pathToProperty}); -} - -/// @nodoc -class __$InstancePathFromInstanceIdCopyWithImpl<$Res> - extends _$InstancePathCopyWithImpl<$Res> - implements _$InstancePathFromInstanceIdCopyWith<$Res> { - __$InstancePathFromInstanceIdCopyWithImpl(_InstancePathFromInstanceId _value, - $Res Function(_InstancePathFromInstanceId) _then) - : super(_value, (v) => _then(v as _InstancePathFromInstanceId)); - - @override - _InstancePathFromInstanceId get _value => - super._value as _InstancePathFromInstanceId; - - @override - $Res call({ - Object? instanceId = freezed, - Object? pathToProperty = freezed, - }) { - return _then(_InstancePathFromInstanceId( - instanceId == freezed - ? _value.instanceId - : instanceId // ignore: cast_nullable_to_non_nullable - as String, - pathToProperty: pathToProperty == freezed - ? _value.pathToProperty - : pathToProperty // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc - -class _$_InstancePathFromInstanceId extends _InstancePathFromInstanceId - with DiagnosticableTreeMixin { - const _$_InstancePathFromInstanceId(this.instanceId, - {this.pathToProperty = const []}) - : super._(); - - @override - final String instanceId; - @JsonKey() - @override - final List pathToProperty; - - @override - 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.runtimeType == runtimeType && - other is _InstancePathFromInstanceId && - const DeepCollectionEquality() - .equals(other.instanceId, instanceId) && - const DeepCollectionEquality() - .equals(other.pathToProperty, pathToProperty)); - } - - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(instanceId), - const DeepCollectionEquality().hash(pathToProperty)); - - @JsonKey(ignore: true) - @override - _$InstancePathFromInstanceIdCopyWith<_InstancePathFromInstanceId> - get copyWith => __$InstancePathFromInstanceIdCopyWithImpl< - _InstancePathFromInstanceId>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function( - String instanceId, List pathToProperty) - fromInstanceId, - required TResult Function( - String providerId, List pathToProperty) - fromProviderId, - }) { - return fromInstanceId(instanceId, pathToProperty); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (fromInstanceId != null) { - return fromInstanceId(instanceId, pathToProperty); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_InstancePathFromInstanceId value) fromInstanceId, - required TResult Function(_InstancePathFromProviderId value) fromProviderId, - }) { - return fromInstanceId(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (fromInstanceId != null) { - return fromInstanceId(this); - } - return orElse(); - } -} - -abstract class _InstancePathFromInstanceId extends InstancePath { - const factory _InstancePathFromInstanceId(String instanceId, - {List pathToProperty}) = _$_InstancePathFromInstanceId; - const _InstancePathFromInstanceId._() : super._(); - - String get instanceId; - @override - List get pathToProperty; - @override - @JsonKey(ignore: true) - _$InstancePathFromInstanceIdCopyWith<_InstancePathFromInstanceId> - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$InstancePathFromProviderIdCopyWith<$Res> - implements $InstancePathCopyWith<$Res> { - factory _$InstancePathFromProviderIdCopyWith( - _InstancePathFromProviderId value, - $Res Function(_InstancePathFromProviderId) then) = - __$InstancePathFromProviderIdCopyWithImpl<$Res>; - @override - $Res call({String providerId, List pathToProperty}); -} - -/// @nodoc -class __$InstancePathFromProviderIdCopyWithImpl<$Res> - extends _$InstancePathCopyWithImpl<$Res> - implements _$InstancePathFromProviderIdCopyWith<$Res> { - __$InstancePathFromProviderIdCopyWithImpl(_InstancePathFromProviderId _value, - $Res Function(_InstancePathFromProviderId) _then) - : super(_value, (v) => _then(v as _InstancePathFromProviderId)); - - @override - _InstancePathFromProviderId get _value => - super._value as _InstancePathFromProviderId; - - @override - $Res call({ - Object? providerId = freezed, - Object? pathToProperty = freezed, - }) { - return _then(_InstancePathFromProviderId( - providerId == freezed - ? _value.providerId - : providerId // ignore: cast_nullable_to_non_nullable - as String, - pathToProperty: pathToProperty == freezed - ? _value.pathToProperty - : pathToProperty // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc - -class _$_InstancePathFromProviderId extends _InstancePathFromProviderId - with DiagnosticableTreeMixin { - const _$_InstancePathFromProviderId(this.providerId, - {this.pathToProperty = const []}) - : super._(); - - @override - final String providerId; - @JsonKey() - @override - final List pathToProperty; - - @override - 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.runtimeType == runtimeType && - other is _InstancePathFromProviderId && - const DeepCollectionEquality() - .equals(other.providerId, providerId) && - const DeepCollectionEquality() - .equals(other.pathToProperty, pathToProperty)); - } - - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(providerId), - const DeepCollectionEquality().hash(pathToProperty)); - - @JsonKey(ignore: true) - @override - _$InstancePathFromProviderIdCopyWith<_InstancePathFromProviderId> - get copyWith => __$InstancePathFromProviderIdCopyWithImpl< - _InstancePathFromProviderId>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function( - String instanceId, List pathToProperty) - fromInstanceId, - required TResult Function( - String providerId, List pathToProperty) - fromProviderId, - }) { - return fromProviderId(providerId, pathToProperty); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (fromProviderId != null) { - return fromProviderId(providerId, pathToProperty); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_InstancePathFromInstanceId value) fromInstanceId, - required TResult Function(_InstancePathFromProviderId value) fromProviderId, - }) { - return fromProviderId(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (fromProviderId != null) { - return fromProviderId(this); - } - return orElse(); - } -} - -abstract class _InstancePathFromProviderId extends InstancePath { - const factory _InstancePathFromProviderId(String providerId, - {List pathToProperty}) = _$_InstancePathFromProviderId; - const _InstancePathFromProviderId._() : super._(); - - String get providerId; - @override - List get pathToProperty; - @override - @JsonKey(ignore: true) - _$InstancePathFromProviderIdCopyWith<_InstancePathFromProviderId> - 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 deleted file mode 100644 index 9a5a13068d8..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_providers.dart +++ /dev/null @@ -1,436 +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. - -import 'dart:async'; - -import 'package:collection/collection.dart'; -import 'package:devtools_app_shared/service.dart'; -import 'package:devtools_app_shared/utils.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:vm_service/vm_service.dart' hide SentinelException; - -import '../../../shared/globals.dart'; -import 'eval.dart'; -import 'instance_details.dart'; -import 'result.dart'; - -Future _resolveInstanceRefForPath( - InstancePath path, { - required AutoDisposeRef ref, - required Disposable isAlive, - required InstanceDetails? parent, -}) async { - if (parent == null) { - // root of the provider tree - - return path.map( - fromProviderId: (path) async { - final eval = await ref.watch(providerEvalProvider.future); - // cause the instances to be re-evaluated when the devtool is notified - // that a provider changed - ref.watch(_providerChanged(path.providerId)); - - return eval.safeEval( - 'ProviderBinding.debugInstance.providerDetails["${path.providerId}"]?.value', - isAlive: isAlive, - ); - }, - fromInstanceId: (path) async { - final eval = await ref.watch(evalProvider.future); - return eval.safeEval( - 'value', - isAlive: isAlive, - scope: {'value': path.instanceId}, - ); - }, - ); - } - - final eval = await ref.watch(evalProvider.future); - - return parent.maybeMap( - // TODO: support sets - // TODO: iterables should use iterators / next() for iterable to navigate, to avoid recomputing the content - - 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 (keyPathRef != null) 'key': keyPathRef, - }, - ); - }, - list: (parent) { - final indexPath = path.pathToProperty.last as ListIndexPath; - - return eval.safeEval( - 'parent[${indexPath.index}]', - isAlive: isAlive, - scope: {'parent': parent.instanceRefId}, - ); - }, - object: (parent) { - final propertyPath = path.pathToProperty.last as PropertyPath; - - // compare by both name and ref ID because an object may have multiple - // fields with the same name - final field = parent.fields.firstWhere( - (element) => - element.name == propertyPath.name && - element.ownerName == propertyPath.ownerName && - element.ownerUri == propertyPath.ownerUri, - ); - - final ref = field.ref.dataOrThrow; - - // we cannot do `eval('parent.propertyName')` because it is possible for - // objects to have multiple properties with the same name - return eval.safeGetInstance(ref, isAlive); - }, - orElse: () => throw Exception('Unexpected instance type.'), - ); -} - -/// Update a variable using the `=` operator. -/// -/// In rare cases, it is possible for this function to mutate the wrong property. -/// This can happen when an object contains multiple fields with the same name -/// (such as private properties or overridden properties), where the conflicting -/// fields are both defined in the same library. -Future _mutate( - String newValueExpression, { - required InstancePath path, - required AutoDisposeRef ref, - required Disposable isAlive, - required InstanceDetails parent, -}) async { - await parent.maybeMap( - list: (parent) async { - final eval = await ref.watch(evalProvider.future); - final indexPath = path.pathToProperty.last as ListIndexPath; - - return eval.safeEval( - 'parent[${indexPath.index}] = $newValueExpression', - isAlive: isAlive, - scope: { - 'parent': parent.instanceRefId, - }, - ); - }, - map: (parent) async { - 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 (keyPathRef != null) 'key': keyPathRef, - }, - ); - }, - // TODO test can mutate properties of a mixin placed in a different library that the class that uses it - object: (parent) { - final propertyPath = path.pathToProperty.last as PropertyPath; - - final field = parent.fields.firstWhere( - (f) => - f.name == propertyPath.name && - f.ownerName == propertyPath.ownerName, - ); - - return field.eval.safeEval( - '(parent as ${propertyPath.ownerName}).${propertyPath.name} = $newValueExpression', - isAlive: isAlive, - scope: { - 'parent': parent.instanceRefId, - }, - ); - }, - orElse: () => throw StateError('Can only mutate lists/maps/objects'), - ); - - // TODO(rrousselGit): call notifyListeners/setState/notifyClients based on the modified object - - // 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. - ref.refresh(instanceProvider(path.root)); - - // Forces the UI to rebuild after the state change - await serviceConnection.serviceManager.performHotReload(); -} - -Future _resolveParent( - AutoDisposeRef ref, - InstancePath path, -) async { - return path.pathToProperty.isNotEmpty - ? await ref.watch(instanceProvider(path.parent!).future) - : null; -} - -Future _tryParseEnum( - Instance instance, { - required EvalOnDartLibrary eval, - required Disposable isAlive, - required String instanceRefId, - required Setter? setter, -}) async { - if (instance.kind != InstanceKind.kPlainInstance || - instance.fields?.length != 2) { - return null; - } - - InstanceRef? findPropertyWithName(String name) { - return instance.fields - ?.firstWhereOrNull((element) => element.name == name) - ?.value; - } - - final nameRef = findPropertyWithName('_name'); - final indexRef = findPropertyWithName('index'); - if (nameRef == null || indexRef == null) return null; - - 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; - - // 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: instance.classRef!.name!, - value: nameSplit.last, - instanceRefId: instanceRefId, - setter: setter, - ); -} - -Setter? _parseSetter({ - required InstancePath path, - required AutoDisposeRef ref, - required Disposable isAlive, - required InstanceDetails? parent, -}) { - if (parent == null) return null; - - Future mutate(String expression) { - return _mutate( - expression, - path: path, - ref: ref, - isAlive: isAlive, - parent: parent, - ); - } - - return parent.maybeMap( - // TODO const collections should have no setter - map: (parent) => mutate, - list: (parent) => mutate, - object: (parent) { - final keyPath = path.pathToProperty.last as PropertyPath; - - // Mutate properties by name as we can't mutate them from a reference. - // 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 && field.ownerName == keyPath.ownerName, - ); - - if (field.isFinal) return null; - return mutate; - }, - orElse: () => throw Exception('Unexpected instance type.'), - ); -} - -/// Fetches informations related to an instance/provider at a given path -/// -/// The UI should not be used directly. Instead, use [instanceProvider]. -// ignore: avoid-explicit-type-declaration, required due to cyclic definition. -final AutoDisposeFutureProviderFamily - instanceProvider = - AutoDisposeFutureProviderFamily( - (ref, path) async { - ref.watch(hotRestartEventProvider); - - final eval = await ref.watch(evalProvider.future); - - final isAlive = Disposable(); - ref.onDispose(isAlive.dispose); - - final parent = await _resolveParent(ref, path); - - final instanceRef = await _resolveInstanceRefForPath( - path, - ref: ref, - parent: parent, - isAlive: isAlive, - ); - - final setter = _parseSetter( - path: path, - isAlive: isAlive, - ref: ref, - parent: parent, - ); - - 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!, - setter: setter, - ); - case InstanceKind.kInt: - case InstanceKind.kDouble: - return InstanceDetails.number( - instance.valueAsString!, - instanceRefId: instanceRef.id!, - setter: setter, - ); - case InstanceKind.kString: - return InstanceDetails.string( - 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 keysFuture = Future.wait([ - for (final keyRef in keysRef) - ref.watch( - instanceProvider(InstancePath.fromInstanceId(keyRef.id!)).future, - ), - ]); - - return InstanceDetails.map( - await keysFuture, - hash: await eval.getHashCode(instance, isAlive: isAlive), - instanceRefId: instanceRef.id!, - setter: setter, - ); - - // TODO(rrousselGit): support sets - // TODO(rrousselGit): support custom lists - // TODO(rrousselGit): support Type - case InstanceKind.kList: - return InstanceDetails.list( - length: instance.length!, - hash: await eval.getHashCode(instance, isAlive: isAlive), - instanceRefId: instanceRef.id!, - setter: setter, - ); - - case InstanceKind.kPlainInstance: - default: - final enumDetails = await _tryParseEnum( - instance, - eval: eval, - isAlive: isAlive, - instanceRefId: instanceRef.id!, - setter: setter, - ); - - if (enumDetails != null) return enumDetails; - - final classInstance = - await eval.safeGetClass(instance.classRef!, isAlive); - final evalForInstance = - // TODO(rrousselGit) when can `library` be null? - ref.watch(libraryEvalProvider(classInstance.library!.uri!).future); - - final appName = tryParsePackageName(eval.isolate!.rootLib!.uri!); - final fields = await _parseFields( - classInstance, - ref, - eval, - isAlive: isAlive, - appName: appName, - ); - - return InstanceDetails.object( - fields.sorted((a, b) => sortFieldsByName(a.name, b.name)), - hash: await eval.getHashCode(instance, isAlive: isAlive), - type: classInstance.name!, - instanceRefId: instanceRef.id!, - evalForInstance: await evalForInstance, - setter: setter, - ); - } - }, -); - -final _packageNameExp = RegExp( - r'package:(.+?)/', -); - -String? tryParsePackageName(String uri) { - return _packageNameExp.firstMatch(uri)?.group(1); -} - -Future> _parseFields( - Class owner, - AutoDisposeRef ref, - EvalOnDartLibrary eval, { - required Disposable isAlive, - required String? appName, -}) { - return owner.fields! - .map((field) async { - final owner = - await eval.safeGetClass(field.owner! as ClassRef, isAlive); - final ownerUri = field.location!.script!.uri!; - final ownerName = owner.mixin?.name ?? owner.name!; - final ownerPackageName = tryParsePackageName(ownerUri); - - return ObjectField( - name: field.name!, - isFinal: field.isFinal!, - ref: parseSentinel(field), - ownerName: ownerName, - ownerUri: ownerUri, - eval: await ref.watch(libraryEvalProvider(ownerUri).future), - isDefinedByDependency: ownerPackageName != appName, - ); - }) - .toList(growable: false) - .wait; -} - -final _providerChanged = - AutoDisposeStreamProviderFamily((ref, id) async* { - final service = await ref.watch(serviceProvider.future); - - yield* service.onExtensionEvent.where((event) { - return event.extensionKind == 'provider:provider_changed' && - 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 deleted file mode 100644 index 174dc58226f..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/instance_viewer.dart +++ /dev/null @@ -1,639 +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. - -// TODO(rrousselGit) merge this code with the debugger view - -import 'dart:async'; -import 'dart:math' as math; - -import 'package:devtools_app_shared/service.dart'; -import 'package:devtools_app_shared/ui.dart'; -import 'package:devtools_app_shared/utils.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -import '../../../shared/diagnostics_text_styles.dart'; -import '../sliver_iterable_child_delegate.dart'; -import 'instance_details.dart'; -import 'instance_providers.dart'; - -const typeColor = Color.fromARGB(255, 78, 201, 176); -const boolColor = Color.fromARGB(255, 86, 156, 214); -const nullColor = boolColor; -const numColor = Color.fromARGB(255, 181, 206, 168); -const stringColor = Color.fromARGB(255, 206, 145, 120); - -const rowHeight = 20.0; - -final isExpandedProvider = StateProviderFamily((ref, path) { - // expands the root by default, but not children - return path.pathToProperty.isEmpty; -}); - -final estimatedChildCountProvider = - AutoDisposeProviderFamily((ref, rootPath) { - int estimatedChildCount(InstancePath path) { - int one(InstanceDetails _) => 1; - - int expandableEstimatedChildCount(Iterable keys) { - if (!ref.watch(isExpandedProvider(path))) { - return 1; - } - return keys.fold(1, (acc, element) { - return acc + - estimatedChildCount( - path.pathForChild(element), - ); - }); - } - - return ref.watch(instanceProvider(path)).when( - loading: () => 1, - error: (err, stack) => 1, - data: (instance) { - return instance.map( - nill: one, - boolean: one, - number: one, - string: one, - enumeration: one, - map: (instance) { - return expandableEstimatedChildCount( - instance.keys.map( - (key) => PathToProperty.mapKey(ref: key.instanceRefId), - ), - ); - }, - list: (instance) { - return expandableEstimatedChildCount( - List.generate(instance.length, $PathToProperty.listIndex), - ); - }, - object: (instance) { - return expandableEstimatedChildCount( - instance.fields.map( - (field) => PathToProperty.fromObjectField(field), - ), - ); - }, - ); - }, - ); - } - - return estimatedChildCount(rootPath); -}); - -void showErrorSnackBar(BuildContext context, Object error) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Error: $error')), - ); -} - -class InstanceViewer extends ConsumerStatefulWidget { - const InstanceViewer({ - super.key, - required this.rootPath, - required this.showInternalProperties, - }); - - final InstancePath rootPath; - final bool showInternalProperties; - - @override - ConsumerState createState() => _InstanceViewerState(); -} - -class _InstanceViewerState extends ConsumerState { - final scrollController = ScrollController(); - - @override - void dispose() { - scrollController.dispose(); - super.dispose(); - } - - Iterable _buildError( - Object error, - StackTrace? _, - InstancePath __, - ) { - if (error is SentinelException) { - final valueAsString = error.sentinel.valueAsString; - if (valueAsString != null) return [Text(valueAsString)]; - } - - return const [Text('')]; - } - - Iterable _buildListViewItems( - BuildContext context, - WidgetRef ref, { - required InstancePath path, - bool disableExpand = false, - }) { - 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, - 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, - bool disableExpand = false, - }) { - return _Expandable( - key: ValueKey(path), - isExpandable: !disableExpand && instance.isExpandable, - isExpanded: isExpanded, - title: instance.map( - enumeration: (instance) => _EditableField( - setter: instance.setter, - initialEditString: '${instance.type}.${instance.value}', - child: Text.rich( - TextSpan( - children: [ - TextSpan( - text: instance.type, - style: const TextStyle(color: typeColor), - ), - TextSpan(text: '.${instance.value}'), - ], - ), - ), - ), - nill: (instance) => _EditableField( - setter: instance.setter, - initialEditString: 'null', - child: const Text('null', style: TextStyle(color: nullColor)), - ), - string: (instance) => _EditableField( - setter: instance.setter, - initialEditString: '"${instance.displayString}"', - child: Text.rich( - TextSpan( - children: [ - const TextSpan(text: '"'), - TextSpan( - text: instance.displayString, - style: const TextStyle(color: stringColor), - ), - const TextSpan(text: '"'), - ], - ), - ), - ), - number: (instance) => _EditableField( - setter: instance.setter, - initialEditString: instance.displayString, - child: Text( - instance.displayString, - style: const TextStyle(color: numColor), - ), - ), - boolean: (instance) => _EditableField( - setter: instance.setter, - initialEditString: instance.displayString, - child: Text( - instance.displayString, - style: const TextStyle(color: boolColor), - ), - ), - map: (instance) => _ObjectHeader( - startToken: '{', - endToken: '}', - hash: instance.hash, - meta: instance.keys.isEmpty - ? null - : '${instance.keys.length} ${pluralize('element', instance.keys.length)}', - ), - list: (instance) => _ObjectHeader( - startToken: '[', - endToken: ']', - hash: instance.hash, - meta: instance.length == 0 - ? null - : '${instance.length} ${pluralize('element', instance.length)}', - ), - object: (instance) => _ObjectHeader( - type: instance.type, - hash: instance.hash, - startToken: '', - endToken: '', - // Never show the number of elements when using custom objects - meta: null, - ), - ), - ); - } - - Iterable _buildMapItem( - BuildContext context, - WidgetRef ref, - MapInstance instance, { - required InstancePath path, - }) sync* { - for (final key in instance.keys) { - final value = _buildListViewItems( - context, - ref, - path: path.pathForChild(PathToProperty.mapKey(ref: key.instanceRefId)), - ); - - final keyHeader = _buildHeader(key, disableExpand: true, path: path); - - var isFirstItem = true; - for (final child in value) { - yield child != null - ? Padding( - padding: const EdgeInsets.only(left: defaultSpacing), - child: isFirstItem - ? Row( - children: [ - keyHeader, - const Text(': '), - Expanded(child: child), - ], - ) - : child, - ) - : const SizedBox(); - - isFirstItem = false; - } - - assert( - !isFirstItem, - 'Bad state: the value of $key did not render any widget', - ); - } - } - - Iterable _buildListItem( - BuildContext context, - WidgetRef ref, - ListInstance instance, { - required InstancePath path, - }) sync* { - for (var index = 0; index < instance.length; index++) { - final children = _buildListViewItems( - context, - ref, - path: path.pathForChild(PathToProperty.listIndex(index)), - ); - - bool isFirst = true; - - for (final child in children) { - Widget? rowItem = child; - - // Add the item index only on the first line of the element - if (isFirst && rowItem != null) { - isFirst = false; - rowItem = Row( - children: [ - Text('[$index]: '), - Expanded(child: rowItem), - ], - ); - } - - yield rowItem != null - ? Padding( - padding: const EdgeInsets.only(left: defaultSpacing), - child: rowItem, - ) - : const SizedBox(); - } - } - } - - Iterable _buildObjectItem( - BuildContext context, - WidgetRef ref, - ObjectInstance instance, { - required InstancePath path, - }) sync* { - for (final field in instance.fields) { - if (!widget.showInternalProperties && - field.isDefinedByDependency && - field.isPrivate) { - // Hide private properties from classes defined by dependencies - continue; - } - - final children = _buildListViewItems( - context, - ref, - path: path.pathForChild(PathToProperty.fromObjectField(field)), - ); - - bool isFirst = true; - - for (final child in children) { - Widget? rowItem = child; - if (isFirst && rowItem != null) { - isFirst = false; - rowItem = Row( - children: [ - if (field.isFinal) - Text( - 'final ', - style: DiagnosticsTextStyles.unimportant( - Theme.of(context).colorScheme, - ), - ), - Text('${field.name}: '), - Expanded(child: rowItem), - ], - ); - } - - yield rowItem != null - ? Padding( - padding: const EdgeInsets.only(left: defaultSpacing), - child: rowItem, - ) - : const SizedBox(); - } - } - } - - @override - Widget build(BuildContext context) { - 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, - // ignore: avoid-unnecessary-type-casts, this code will be removed soon. - ).cast(), // This cast is necessary to avoid Null type errors - estimatedChildCount: - ref.watch(estimatedChildCountProvider(widget.rootPath)), - ), - ), - ); - } -} - -class _ObjectHeader extends StatelessWidget { - const _ObjectHeader({ - this.type, - required this.hash, - required this.meta, - required this.startToken, - required this.endToken, - }); - - final String? type; - final int hash; - final String? meta; - final String startToken; - final String endToken; - - @override - Widget build(BuildContext context) { - final colorScheme = Theme.of(context).colorScheme; - - return Text.rich( - TextSpan( - children: [ - if (type != null) - TextSpan( - text: type, - style: const TextStyle(color: typeColor), - ), - TextSpan( - text: '#${shortHash(hash)}', - style: DiagnosticsTextStyles.unimportant(colorScheme), - ), - TextSpan(text: startToken), - if (meta != null) TextSpan(text: meta), - TextSpan(text: endToken), - ], - ), - ); - } -} - -class _EditableField extends StatefulWidget { - const _EditableField({ - required this.setter, - required this.child, - required this.initialEditString, - }); - - final Widget child; - final String initialEditString; - final Future Function(String)? setter; - - @override - _EditableFieldState createState() => _EditableFieldState(); -} - -class _EditableFieldState extends State<_EditableField> { - final controller = TextEditingController(); - final focusNode = FocusNode(debugLabel: 'editable-field'); - final textFieldFocusNode = FocusNode(debugLabel: 'text-field'); - var isHovering = false; - - final _isAlive = Disposable(); - - @override - void dispose() { - _isAlive.dispose(); - controller.dispose(); - focusNode.dispose(); - textFieldFocusNode.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - if (widget.setter == null) return widget.child; - - final colorScheme = Theme.of(context).colorScheme; - - final editingChild = TextField( - autofocus: true, - controller: controller, - focusNode: textFieldFocusNode, - onSubmitted: (value) async { - try { - final setter = widget.setter; - if (setter != null) await setter(value); - } catch (err) { - if (!context.mounted) return; - showErrorSnackBar(context, err); - } - }, - decoration: InputDecoration( - contentPadding: const EdgeInsets.all(densePadding), - isDense: true, - border: OutlineInputBorder( - borderRadius: const BorderRadius.all(Radius.circular(5)), - borderSide: BorderSide(color: colorScheme.surface), - ), - ), - ); - - final displayChild = Stack( - clipBehavior: Clip.none, - children: [ - if (isHovering) - Positioned( - bottom: -5, - left: -5, - top: -5, - right: -5, - child: DecoratedBox( - decoration: BoxDecoration( - borderRadius: defaultBorderRadius, - border: Border.all(color: colorScheme.surface), - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - focusNode.requestFocus(); - textFieldFocusNode.requestFocus(); - controller.text = widget.initialEditString; - controller.selection = TextSelection( - baseOffset: 0, - extentOffset: widget.initialEditString.length, - ); - }, - child: Align( - alignment: Alignment.centerLeft, - heightFactor: 1, - child: widget.child, - ), - ), - ], - ); - - return AnimatedBuilder( - animation: focusNode, - builder: (context, _) { - final isEditing = focusNode.hasFocus; - - return Focus( - focusNode: focusNode, - onKeyEvent: (node, key) { - if (key.physicalKey == PhysicalKeyboardKey.escape) { - focusNode.unfocus(); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - }, - child: MouseRegion( - onEnter: (_) => setState(() => isHovering = true), - onExit: (_) => setState(() => isHovering = false), - // use a Stack to show the borders, to avoid the UI "moving" when hovering - child: isEditing ? editingChild : displayChild, - ), - ); - }, - ); - } -} - -class _Expandable extends StatelessWidget { - const _Expandable({ - super.key, - required this.isExpanded, - required this.isExpandable, - required this.title, - }); - - final StateController? isExpanded; - final bool isExpandable; - final Widget title; - - @override - Widget build(BuildContext context) { - if (!isExpandable) { - return Align( - alignment: Alignment.centerLeft, - child: title, - ); - } - - final isExpanded = this.isExpanded!; - - return GestureDetector( - onTap: () => isExpanded.state = !isExpanded.state, - behavior: HitTestBehavior.opaque, - child: Row( - children: [ - TweenAnimationBuilder( - tween: Tween(end: isExpanded.state ? 0 : -math.pi / 2), - duration: defaultDuration, - builder: (context, angle, _) { - return Transform.rotate( - angle: angle, - child: Icon( - Icons.expand_more, - size: defaultIconSize, - ), - ); - }, - ), - title, - ], - ), - ); - } -} 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 deleted file mode 100644 index 746129b8e75..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.dart +++ /dev/null @@ -1,82 +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. - -import 'package:collection/collection.dart'; -import 'package:devtools_app_shared/service.dart'; -import 'package:flutter/foundation.dart'; -import 'package:vm_service/vm_service.dart' hide SentinelException, Error; - -import 'fake_freezed_annotation.dart'; - -// This part is generated using `package:freezed`, but without the devtool depending -// on the package. -// To update the generated files, temporarily add freezed/freezed_annotation/build_runner -// as dependencies; replace the `fake_freezed_annotation.dart` import with the -// real annotation package, then execute `pub run build_runner build`. -part 'result.freezed.dart'; - -@freezed -class Result with _$Result { - Result._(); - factory Result.data(T value) = _ResultData; - factory Result.error(Object error, StackTrace stackTrace) = _ResultError; - - factory Result.guard(T Function() cb) { - try { - return Result.data(cb()); - } catch (err, stack) { - return Result.error(err, stack); - } - } - - static Future> guardFuture(Future Function() cb) async { - try { - return Result.data(await cb()); - } catch (err, stack) { - return Result.error(err, stack); - } - } - - Result chain(Res Function(T value) cb) { - return when( - data: (value) { - try { - return Result.data(cb(value)); - } catch (err, stack) { - return Result.error(err, stack); - } - }, - error: (err, stack) => Result.error(err, stack), - ); - } - - T get dataOrThrow { - return when( - data: (value) => value, - error: Error.throwWithStackTrace, - ); - } -} - -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), - StackTrace.current, - ); - } - - return Result.error(value, StackTrace.current); -} 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 deleted file mode 100644 index 5463597051f..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/instance_viewer/result.freezed.dart +++ /dev/null @@ -1,389 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// 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'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -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(); - - _ResultData data(T value) { - return _ResultData( - value, - ); - } - - _ResultError error(Object error, StackTrace stackTrace) { - return _ResultError( - error, - stackTrace, - ); - } -} - -/// @nodoc -const $Result = _$ResultTearOff(); - -/// @nodoc -mixin _$Result { - @optionalTypeArgs - 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 Function(T value)? data, - TResult Function(Object error, StackTrace stackTrace)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_ResultData value) data, - required TResult Function(_ResultError value) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - 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 -abstract class $ResultCopyWith { - factory $ResultCopyWith(Result value, $Res Function(Result) then) = - _$ResultCopyWithImpl; -} - -/// @nodoc -class _$ResultCopyWithImpl implements $ResultCopyWith { - _$ResultCopyWithImpl(this._value, this._then); - - final Result _value; - // ignore: unused_field - final $Res Function(Result) _then; -} - -/// @nodoc -abstract class _$ResultDataCopyWith { - factory _$ResultDataCopyWith( - _ResultData value, $Res Function(_ResultData) then) = - __$ResultDataCopyWithImpl; - $Res call({T value}); -} - -/// @nodoc -class __$ResultDataCopyWithImpl extends _$ResultCopyWithImpl - implements _$ResultDataCopyWith { - __$ResultDataCopyWithImpl( - _ResultData _value, $Res Function(_ResultData) _then) - : super(_value, (v) => _then(v as _ResultData)); - - @override - _ResultData get _value => super._value as _ResultData; - - @override - $Res call({ - Object? value = freezed, - }) { - return _then(_ResultData( - value == freezed - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as T, - )); - } -} - -/// @nodoc - -class _$_ResultData extends _ResultData with DiagnosticableTreeMixin { - _$_ResultData(this.value) : super._(); - - @override - final T value; - - @override - 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.runtimeType == runtimeType && - other is _ResultData && - const DeepCollectionEquality().equals(other.value, value)); - } - - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(value)); - - @JsonKey(ignore: true) - @override - _$ResultDataCopyWith> get copyWith => - __$ResultDataCopyWithImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(T value) data, - required TResult Function(Object error, StackTrace stackTrace) error, - }) { - return data(value); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (data != null) { - return data(value); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_ResultData value) data, - required TResult Function(_ResultError value) error, - }) { - return data(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (data != null) { - return data(this); - } - return orElse(); - } -} - -abstract class _ResultData extends Result { - factory _ResultData(T value) = _$_ResultData; - _ResultData._() : super._(); - - T get value; - @JsonKey(ignore: true) - _$ResultDataCopyWith> get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$ResultErrorCopyWith { - factory _$ResultErrorCopyWith( - _ResultError value, $Res Function(_ResultError) then) = - __$ResultErrorCopyWithImpl; - $Res call({Object error, StackTrace stackTrace}); -} - -/// @nodoc -class __$ResultErrorCopyWithImpl extends _$ResultCopyWithImpl - implements _$ResultErrorCopyWith { - __$ResultErrorCopyWithImpl( - _ResultError _value, $Res Function(_ResultError) _then) - : super(_value, (v) => _then(v as _ResultError)); - - @override - _ResultError get _value => super._value as _ResultError; - - @override - $Res call({ - Object? error = freezed, - Object? stackTrace = freezed, - }) { - return _then(_ResultError( - 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 with DiagnosticableTreeMixin { - _$_ResultError(this.error, this.stackTrace) : super._(); - - @override - final Object error; - @override - final StackTrace stackTrace; - - @override - 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.runtimeType == runtimeType && - other is _ResultError && - const DeepCollectionEquality().equals(other.error, error) && - const DeepCollectionEquality() - .equals(other.stackTrace, stackTrace)); - } - - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(error), - const DeepCollectionEquality().hash(stackTrace)); - - @JsonKey(ignore: true) - @override - _$ResultErrorCopyWith> get copyWith => - __$ResultErrorCopyWithImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(T value) data, - required TResult Function(Object error, StackTrace stackTrace) error, - }) { - return error(this.error, stackTrace); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (error != null) { - return error(this.error, stackTrace); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_ResultData value) data, - required TResult Function(_ResultError value) error, - }) { - return error(this); - } - - @override - @optionalTypeArgs - 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(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } -} - -abstract class _ResultError extends Result { - factory _ResultError(Object error, StackTrace stackTrace) = _$_ResultError; - _ResultError._() : super._(); - - Object get error; - StackTrace get stackTrace; - @JsonKey(ignore: true) - _$ResultErrorCopyWith> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/packages/devtools_app/lib/src/screens/provider/provider_list.dart b/packages/devtools_app/lib/src/screens/provider/provider_list.dart deleted file mode 100644 index 891bd6b67e2..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/provider_list.dart +++ /dev/null @@ -1,127 +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. - -import 'package:devtools_app_shared/ui.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -import 'provider_nodes.dart'; - -const _tilePadding = EdgeInsets.only( - left: defaultSpacing, - right: densePadding, - top: densePadding, - bottom: densePadding, -); - -final selectedProviderIdProvider = - AutoDisposeStateNotifierProvider, String?>( - (ref) { - final controller = StateController(null); - - ref.listen>>( - sortedProviderNodesProvider, - (prev, value) { - final nodes = value.asData?.value; - if (nodes == null) return; - - if (controller.state == null) { - if (nodes.isNotEmpty) controller.state = nodes.first.id; - return; - } - - if (nodes.isEmpty) { - controller.state = null; - } - - /// The previously selected provider was unmounted - else if (!nodes.any((node) => node.id == controller.state)) { - controller.state = nodes.first.id; - } - }, - fireImmediately: true, - ); - - return controller; - }, - name: 'selectedProviderIdProvider', -); - -class ProviderList extends ConsumerStatefulWidget { - const ProviderList({super.key}); - - @override - ConsumerState createState() => _ProviderListState(); -} - -class _ProviderListState extends ConsumerState { - final scrollController = ScrollController(); - - @override - void dispose() { - scrollController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - 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, - ); - }, - ), - ); - }, - ); - } -} - -class ProviderNodeItem extends ConsumerWidget { - const ProviderNodeItem({ - super.key, - required this.node, - }); - - final ProviderNode node; - - @override - Widget build(BuildContext context, WidgetRef ref) { - final isSelected = ref.watch(selectedProviderIdProvider) == node.id; - - final colorScheme = Theme.of(context).colorScheme; - final backgroundColor = - isSelected ? colorScheme.selectedRowBackgroundColor : null; - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - ref.read(selectedProviderIdProvider.notifier).state = node.id; - }, - child: Container( - color: backgroundColor, - padding: _tilePadding, - child: Text('${node.type}()'), - ), - ); - } -} diff --git a/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart b/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart deleted file mode 100644 index e0ec37655ce..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/provider_nodes.dart +++ /dev/null @@ -1,107 +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. - -import 'dart:async'; - -import 'package:devtools_app_shared/service.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:vm_service/vm_service.dart'; - -import 'instance_viewer/eval.dart'; - -@immutable -class ProviderNode { - const ProviderNode({ - required this.id, - required this.type, - }); - - final String id; - final String type; -} - -final _providerListChanged = AutoDisposeStreamProvider((ref) async* { - final service = await ref.watch(serviceProvider.future); - - yield* service.onExtensionEvent.where((event) { - return event.extensionKind == 'provider:provider_list_changed'; - }); -}); - -final _rawProviderIdsProvider = AutoDisposeFutureProvider>( - (ref) async { - // recompute the list of providers on hot-restart - ref.watch(hotRestartEventProvider); - // cause the list of providers to be re-evaluated when notified of a change - ref.watch(_providerListChanged); - - final isAlive = Disposable(); - ref.onDispose(isAlive.dispose); - - final eval = await ref.watch(providerEvalProvider.future); - - final providerIdRefs = await eval.evalInstance( - 'ProviderBinding.debugInstance.providerDetails.keys.toList()', - isAlive: isAlive, - ); - - final providerIdInstances = await Future.wait([ - for (final idRef in providerIdRefs.elements!.cast()) - eval.safeGetInstance(idRef, isAlive), - ]); - - return [ - for (final idInstance in providerIdInstances) idInstance.valueAsString!, - ]; - }, - name: '_rawProviderIdsProvider', -); - -final _rawProviderNodeProvider = - AutoDisposeFutureProviderFamily( - (ref, id) async { - // recompute the providers informations on hot-restart - ref.watch(hotRestartEventProvider); - - final isAlive = Disposable(); - ref.onDispose(isAlive.dispose); - - final eval = await ref.watch(providerEvalProvider.future); - - final providerNodeInstance = await eval.evalInstance( - "ProviderBinding.debugInstance.providerDetails['$id']", - isAlive: isAlive, - ); - - Future getFieldWithName(String name) { - return eval.safeGetInstance( - providerNodeInstance.fields!.firstWhere((e) => e.name == name).value - as InstanceRef, - isAlive, - ); - } - - final type = await getFieldWithName('type'); - - return ProviderNode( - id: id, - type: type.valueAsString!, - ); - }, - name: '_rawProviderNodeProvider', -); - -/// Combines [providerIdsProvider] with [providerNodeProvider] to obtain all -/// the [ProviderNode]s at once, sorted alphabetically. -final sortedProviderNodesProvider = - AutoDisposeFutureProvider>((ref) async { - final ids = await ref.watch(_rawProviderIdsProvider.future); - - final nodes = await Future.wait( - ids.map((id) => ref.watch(_rawProviderNodeProvider(id).future)), - ); - - return nodes.toList()..sort((a, b) => a.type.compareTo(b.type)); -}); 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 a86016aa7a9..30162a6ea83 100644 --- a/packages/devtools_app/lib/src/screens/provider/provider_screen.dart +++ b/packages/devtools_app/lib/src/screens/provider/provider_screen.dart @@ -2,49 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:async'; - -import 'package:collection/collection.dart'; import 'package:devtools_app_shared/ui.dart'; -import 'package:devtools_app_shared/utils.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import '../../shared/analytics/analytics.dart' as ga; -import '../../shared/banner_messages.dart'; import '../../shared/common_widgets.dart'; -import '../../shared/globals.dart'; import '../../shared/screen.dart'; -import 'instance_viewer/eval.dart'; -import 'instance_viewer/instance_details.dart'; -import 'instance_viewer/instance_providers.dart'; -import 'instance_viewer/instance_viewer.dart'; -import 'provider_list.dart'; -import 'provider_nodes.dart'; - -final _hasErrorProvider = Provider.autoDispose((ref) { - if (ref.watch(sortedProviderNodesProvider) is AsyncError) return true; - - final selectedProviderId = ref.watch(selectedProviderIdProvider); - - if (selectedProviderId == null) return false; - - final instance = ref.watch( - instanceProvider(InstancePath.fromProviderId(selectedProviderId)), - ); - - return instance is AsyncError; -}); - -final _selectedProviderNode = AutoDisposeProvider((ref) { - final selectedId = ref.watch(selectedProviderIdProvider); - - return ref.watch(sortedProviderNodesProvider).asData?.value.firstWhereOrNull( - (node) => node.id == selectedId, - ); -}); - -final _showInternals = StateProvider((ref) => false); class ProviderScreen extends Screen { ProviderScreen() : super.fromMetaData(ScreenMetaData.provider); @@ -53,151 +15,19 @@ class ProviderScreen extends Screen { @override Widget buildScreenBody(BuildContext context) { - return const ProviderScreenWrapper(); - } -} - -class ProviderScreenWrapper extends StatefulWidget { - const ProviderScreenWrapper({super.key}); - - @override - State createState() => _ProviderScreenWrapperState(); -} - -class _ProviderScreenWrapperState extends State - with AutoDisposeMixin { - @override - void initState() { - super.initState(); - ga.screen(ProviderScreen.id); - - cancelListeners(); - addAutoDisposeListener(serviceConnection.serviceManager.connectedState, () { - if (serviceConnection.serviceManager.connectedState.value.connected) { - setServiceConnectionForProviderScreen( - serviceConnection.serviceManager.service!, - ); - } - }); - } - - @override - Widget build(BuildContext context) { - return const ProviderScreenBody(); - } -} - -class ProviderScreenBody extends ConsumerWidget { - const ProviderScreenBody({super.key}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final splitAxis = SplitPane.axisFor(context, 0.85); - - // A provider will automatically be selected as soon as one is detected - final selectedProviderId = ref.watch(selectedProviderIdProvider); - final detailsTitleText = selectedProviderId != null - ? ref.watch(_selectedProviderNode)?.type ?? '' - : '[No provider selected]'; - - ref.listen(_hasErrorProvider, (_, hasError) { - if (hasError) showProviderErrorBanner(); - }); - - return SplitPane( - axis: splitAxis, - initialFractions: const [0.33, 0.67], - children: [ - const RoundedOutlinedBorder( - clip: true, - child: Column( - children: [ - AreaPaneHeader( - roundedTopBorder: false, - includeTopBorder: false, - title: Text('Providers'), - ), - Expanded( - child: ProviderList(), - ), - ], - ), + return CenteredMessage( + richMessage: [ + const TextSpan( + text: 'The Provider screen is now shipped as a DevTools extension.\n' + 'If you want to use this tool, please upgrade your ', ), - RoundedOutlinedBorder( - clip: true, - child: Column( - children: [ - AreaPaneHeader( - roundedTopBorder: false, - includeTopBorder: false, - title: Text(detailsTitleText), - actions: [ - ToolbarAction( - icon: Icons.settings, - onPressed: () { - unawaited( - showDialog( - context: context, - builder: (_) => _StateInspectorSettingsDialog(), - ), - ); - }, - ), - ], - ), - if (selectedProviderId != null) - Expanded( - child: InstanceViewer( - rootPath: InstancePath.fromProviderId(selectedProviderId), - showInternalProperties: ref.watch(_showInternals), - ), - ), - ], - ), + TextSpan( + text: 'package:provider', + style: Theme.of(context).fixedFontStyle, + ), + const TextSpan( + text: ' dependency to the latest version, and then re-open DevTools.', ), - ], - ); - } -} - -void showProviderErrorBanner() { - bannerMessages.addMessage( - ProviderUnknownErrorBanner(screenId: ProviderScreen.id).build(), - ); -} - -class _StateInspectorSettingsDialog extends ConsumerWidget { - static const title = 'State inspector configurations'; - - @override - Widget build(BuildContext context, WidgetRef ref) { - return DevToolsDialog( - title: const DialogTitleText(title), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - onTap: () => - ref.read(_showInternals.notifier).update((state) => !state), - child: Row( - children: [ - Checkbox( - value: ref.watch(_showInternals), - onChanged: (_) => ref - .read(_showInternals.notifier) - .update((state) => !state), - ), - const Text( - 'Show private properties inherited from SDKs/packages', - ), - ], - ), - ), - ], - ), - actions: const [ - DialogCloseButton(), ], ); } 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 deleted file mode 100644 index 0134399717e..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/riverpod_error_logger_observer.dart +++ /dev/null @@ -1,44 +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. - -import 'package:devtools_app_shared/service.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:logging/logging.dart'; - -final _log = Logger('riverpod_error_logger_observer'); - -class ErrorLoggerObserver extends ProviderObserver { - const ErrorLoggerObserver(); - - @override - void didAddProvider( - ProviderBase provider, - Object? value, - ProviderContainer container, - ) { - _maybeLogError(provider, value); - } - - @override - void didUpdateProvider( - ProviderBase provider, - Object? previousValue, - Object? newValue, - ProviderContainer container, - ) { - _maybeLogError(provider, newValue); - } - - void _maybeLogError(ProviderBase provider, Object? value) { - if (value is AsyncError) { - if (value.error is SentinelException) return; - _log.shout('Provider $provider failed with "${value.error}"'); - - final stackTrace = value.stackTrace; - if (stackTrace != null) { - _log.info(stackTrace); - } - } - } -} diff --git a/packages/devtools_app/lib/src/screens/provider/sliver_iterable_child_delegate.dart b/packages/devtools_app/lib/src/screens/provider/sliver_iterable_child_delegate.dart deleted file mode 100644 index da32e4c60ff..00000000000 --- a/packages/devtools_app/lib/src/screens/provider/sliver_iterable_child_delegate.dart +++ /dev/null @@ -1,43 +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. - -import 'package:flutter/widgets.dart'; - -/// A delegate that allows using ListView with an undetermined list length -/// while preserve the "build only what is visible" behaviour. -class SliverIterableChildDelegate extends SliverChildDelegate { - SliverIterableChildDelegate( - this.children, { - this.estimatedChildCount, - }); - - final Iterable children; - int? _lastAccessedIndex; - late Iterator _lastAccessedIterator; - - @override - Widget? build(BuildContext context, int index) { - if (_lastAccessedIndex == null || _lastAccessedIndex! > index) { - _lastAccessedIndex = -1; - _lastAccessedIterator = children.iterator; - } - - while (_lastAccessedIndex! < index) { - _lastAccessedIterator.moveNext(); - _lastAccessedIndex = _lastAccessedIndex! + 1; - } - - return _lastAccessedIterator.current; - } - - @override - final int? estimatedChildCount; - - @override - bool shouldRebuild(SliverIterableChildDelegate oldDelegate) { - return children != oldDelegate.children || - _lastAccessedIndex != oldDelegate._lastAccessedIndex || - _lastAccessedIterator != oldDelegate._lastAccessedIterator; - } -} diff --git a/packages/devtools_app/lib/src/shared/common_widgets.dart b/packages/devtools_app/lib/src/shared/common_widgets.dart index 553731dca5c..a0c39ddaa9d 100644 --- a/packages/devtools_app/lib/src/shared/common_widgets.dart +++ b/packages/devtools_app/lib/src/shared/common_widgets.dart @@ -825,20 +825,34 @@ class LeftBorder extends StatelessWidget { final goldenRatio = 1 + sqrt(5) / 2; /// A centered text widget with the default DevTools text style applied. +/// +/// Only one of [message] or [richMessage] can be specified. class CenteredMessage extends StatelessWidget { - const CenteredMessage(this.message, {super.key}); + const CenteredMessage({ + this.message, + this.richMessage, + super.key, + }) : assert((message == null) != (richMessage == null)); + + final String? message; - final String message; + final List? richMessage; @override Widget build(BuildContext context) { - return Center( - child: Text( - message, + Widget child; + if (message != null) { + child = Text( + message!, textAlign: TextAlign.center, style: Theme.of(context).regularTextStyle, - ), - ); + ); + } else { + child = RichText( + text: TextSpan(children: richMessage), + ); + } + return Center(child: child); } } diff --git a/packages/devtools_app/lib/src/shared/file_import.dart b/packages/devtools_app/lib/src/shared/file_import.dart index 7cd880eb870..79b36cbc329 100644 --- a/packages/devtools_app/lib/src/shared/file_import.dart +++ b/packages/devtools_app/lib/src/shared/file_import.dart @@ -128,7 +128,7 @@ class _FileImportContainerState extends State { ), const SizedBox(height: extraLargeSpacing), ], - CenteredMessage(widget.instructions), + CenteredMessage(message: widget.instructions), const SizedBox(height: denseSpacing), _buildImportFileRow(), if (widget.actionText != null && widget.onAction != null) diff --git a/packages/devtools_app/lib/src/shared/offline_screen.dart b/packages/devtools_app/lib/src/shared/offline_screen.dart index 02a5dda5181..8a4f0a7bc7b 100644 --- a/packages/devtools_app/lib/src/shared/offline_screen.dart +++ b/packages/devtools_app/lib/src/shared/offline_screen.dart @@ -88,7 +88,7 @@ class _OfflineLoadError extends StatelessWidget { return Column( children: [ CenteredMessage( - 'Cannot load offline data for screen \'$screenId\'', + message: 'Cannot load offline data for screen \'$screenId\'', ), const SizedBox(height: defaultSpacing), ExitOfflineButton(gaScreen: gac.simple), diff --git a/packages/devtools_app/pubspec.yaml b/packages/devtools_app/pubspec.yaml index 39f66f89872..07f350215aa 100644 --- a/packages/devtools_app/pubspec.yaml +++ b/packages/devtools_app/pubspec.yaml @@ -31,8 +31,6 @@ dependencies: flutter: sdk: flutter flutter_markdown: ^0.7.1 - # TODO: https://github.com/flutter/devtools/issues/4569 - unpin this version - flutter_riverpod: 2.0.0-dev.9 flutter_web_plugins: sdk: flutter http: ^1.1.0 diff --git a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md index 53f59c93396..df3400cc6f8 100644 --- a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md +++ b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md @@ -10,14 +10,18 @@ To learn more about DevTools, check out the ## General updates -* Fixed a bug that was causing the DevTools release notes to always -show. - [#8277](https://github.com/flutter/devtools/pull/8277) - * Add a setting that allows users to opt-in to loading DevTools with WebAssembly. - [#8270](https://github.com/flutter/devtools/pull/8270) ![Wasm opt-in setting](images/wasm_setting.png "DevTools setting to opt into wasm.") +* Removed the legacy Provider screen from DevTools. The `package:provider` tool is now +distributed as a DevTools extension from `package:provider`. Upgrade your `package:provider` +dependency to use the extension. - [#8364](https://github.com/flutter/devtools/pull/8364) + +* Fixed a bug that was causing the DevTools release notes to always +show. - [#8277](https://github.com/flutter/devtools/pull/8277) + * Added support for loading extensions in pub workspaces [8347](https://github.com/flutter/devtools/pull/8347). diff --git a/packages/devtools_app/test/shared/instance_viewer_test.dart b/packages/devtools_app/test/shared/instance_viewer_test.dart deleted file mode 100644 index 88fe5fbe333..00000000000 --- a/packages/devtools_app/test/shared/instance_viewer_test.dart +++ /dev/null @@ -1,1544 +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. - -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_shared/service.dart'; -import 'package:devtools_app_shared/ui.dart'; -import 'package:devtools_app_shared/utils.dart'; -import 'package:devtools_test/devtools_test.dart'; -import 'package:devtools_test/helpers.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'; - -import '../test_infra/matchers/matchers.dart'; - -final alwaysExpandedOverride = isExpandedProvider - .overrideWithProvider((param) => StateProvider((ref) => true)); - -final neverExpandedOverride = isExpandedProvider - .overrideWithProvider((param) => StateProvider((ref) => false)); - -final emptyObjectInstance = AsyncValue.data( - InstanceDetails.object( - const [], - hash: 0, - instanceRefId: 'map0', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', - ), -); - -final object2Instance = AsyncValue.data( - InstanceDetails.object( - [ - ObjectField( - name: 'first', - isFinal: true, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ObjectField( - name: 'second', - isFinal: true, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', - ), -); - -final emptyMapInstance = AsyncValue.data( - InstanceDetails.map(const [], hash: 0, instanceRefId: 'map0', setter: null), -); - -final map2Instance = AsyncValue.data( - InstanceDetails.map( - [ - stringInstance.value!, - list2Instance.value!, - ], - hash: 0, - instanceRefId: '0', - setter: null, - ), -); - -final emptyListInstance = AsyncValue.data( - InstanceDetails.list( - length: 0, - hash: 0, - instanceRefId: 'list0', - setter: null, - ), -); - -final list2Instance = AsyncValue.data( - InstanceDetails.list( - length: 2, - hash: 0, - instanceRefId: 'list2', - setter: null, - ), -); - -final stringInstance = AsyncValue.data( - InstanceDetails.string('string', instanceRefId: 'string', setter: null), -); - -final nullInstance = AsyncValue.data(InstanceDetails.nill(setter: null)); - -final trueInstance = AsyncValue.data( - InstanceDetails.boolean('true', instanceRefId: 'true', setter: null), -); - -final int42Instance = AsyncValue.data( - InstanceDetails.number('42', instanceRefId: '42', setter: null), -); - -final enumValueInstance = AsyncValue.data( - InstanceDetails.enumeration( - type: 'Enum', - value: 'value', - setter: null, - instanceRefId: 'Enum.value', - ), -); - -void main() { - setUpAll(() async => await loadFonts()); - - setUp(() { - setGlobal( - DevToolsEnvironmentParameters, - ExternalDevToolsEnvironmentParameters(), - ); - setGlobal(IdeTheme, getIdeTheme()); - setGlobal(ServiceConnectionManager, FakeServiceConnectionManager()); - }); - - group('InstanceViewer', () { - testWidgets( - 'showInternalProperties: false hides private properties from dependencies', - (tester) async { - const objPath = InstancePath.fromInstanceId('obj'); - - InstancePath pathForProperty(String name) { - return objPath.pathForChild( - PathToProperty.objectProperty( - name: name, - ownerUri: '', - ownerName: '', - ), - ); - } - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(objPath).overrideWithValue( - AsyncValue.data( - ObjectInstance( - [ - ObjectField( - name: 'first', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: true, - ), - ObjectField( - name: '_second', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: true, - ), - ObjectField( - name: 'third', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ObjectField( - name: '_forth', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', - ), - ), - ), - instanceProvider(pathForProperty('first')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('_second')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('third')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('_forth')) - .overrideWithValue(int42Instance), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: false, - rootPath: objPath, - ), - ), - ), - ), - ); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/show_internal_properties.png', - ), - ); - }, - ); - - testWidgets('field editing flow', (tester) async { - const objPath = InstancePath.fromInstanceId('obj'); - final propertyPath = objPath.pathForChild( - const PathToProperty.objectProperty( - name: 'first', - ownerUri: '', - ownerName: '', - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(objPath).overrideWithValue( - AsyncValue.data( - ObjectInstance( - [ - ObjectField( - name: 'first', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', - ), - ), - ), - instanceProvider(propertyPath).overrideWithValue( - AsyncValue.data( - InstanceDetails.number( - '0', - instanceRefId: '0', - setter: (_) async {}, - ), - ), - ), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: objPath, - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await tester.tap(find.byKey(ValueKey(propertyPath))); - - await tester.pump(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../test_infra/goldens/instance_viewer/edit.png'), - ); - - // can press esc to unfocus active node - await tester.sendKeyEvent(LogicalKeyboardKey.escape); - - await tester.pump(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/edit_esc.png', - ), - ); - }); - - testWidgets( - 'renders while an instance is fetched', - (tester) async { - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/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 { - const app = MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: app, - ), - ); - await tester.pump(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/null.png', - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue( - AsyncValue.error(StateError('test error')), - ), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/error.png', - ), - ); - }, - ); - - testWidgets( - 'once valid data was fetched, going back to loading and emiting a new value immediately updates the UI', - (tester) async { - const app = MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: app, - ), - ); - await tester.pump(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/null.png', - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(int42Instance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/num.png', - ), - ); - }, - ); - - testWidgets('renders enums', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('enum')) - .overrideWithValue(enumValueInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('enum'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../test_infra/goldens/instance_viewer/enum.png'), - ); - }); - - testWidgets('renders null', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('null')) - .overrideWithValue(nullInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('null'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../test_infra/goldens/instance_viewer/null.png'), - ); - }); - - testWidgets('renders bools', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('bool')) - .overrideWithValue(trueInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('bool'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../test_infra/goldens/instance_viewer/bool.png'), - ); - }); - - testWidgets('renders strings', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('string')) - .overrideWithValue(stringInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('string'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/string.png', - ), - ); - }); - - testWidgets('renders numbers', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('num')) - .overrideWithValue(int42Instance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('num'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../test_infra/goldens/instance_viewer/num.png'), - ); - }); - - testWidgets('renders maps', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('map')) - .overrideWithValue(map2Instance), - // {'string': 42, [...]: ['string', null]} - instanceProvider( - const InstancePath.fromInstanceId( - 'map', - pathToProperty: [PathToProperty.mapKey(ref: 'string')], - ), - ).overrideWithValue(int42Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map', - pathToProperty: [PathToProperty.mapKey(ref: 'list2')], - ), - ).overrideWithValue(list2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map', - pathToProperty: [ - PathToProperty.mapKey(ref: 'list2'), - PathToProperty.listIndex(0), - ], - ), - ).overrideWithValue(stringInstance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map', - pathToProperty: [ - PathToProperty.mapKey(ref: 'list2'), - PathToProperty.listIndex(1), - ], - ), - ).overrideWithValue(nullInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('map'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/collasped_map.png', - ), - ); - - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - 'map', - pathToProperty: [PathToProperty.mapKey(ref: 'list2')], - ), - ).notifier, - ) - .state = true; - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/expanded_map.png', - ), - ); - }); - - testWidgets('renders objects', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('object')) - .overrideWithValue(object2Instance), - // MyClass(first: 42, second: ['string', null]) - instanceProvider( - const InstancePath.fromInstanceId( - 'object', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'first', - ownerUri: '', - ownerName: '', - ), - ], - ), - ).overrideWithValue(int42Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - ], - ), - ).overrideWithValue(list2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - PathToProperty.listIndex(0), - ], - ), - ).overrideWithValue(stringInstance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - PathToProperty.listIndex(1), - ], - ), - ).overrideWithValue(nullInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('object'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/collasped_object.png', - ), - ); - - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - 'object', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - ], - ), - ).notifier, - ) - .state = true; - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/expanded_object.png', - ), - ); - }); - - testWidgets('renders lists', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('list')) - .overrideWithValue(list2Instance), - // [true, {'string': 42, [...]: null}] - instanceProvider( - const InstancePath.fromInstanceId( - 'list', - pathToProperty: [ - PathToProperty.listIndex(0), - ], - ), - ).overrideWithValue(trueInstance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list', - pathToProperty: [ - PathToProperty.listIndex(1), - ], - ), - ).overrideWithValue(map2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list', - pathToProperty: [ - PathToProperty.listIndex(1), - PathToProperty.mapKey(ref: 'string'), - ], - ), - ).overrideWithValue(int42Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list', - pathToProperty: [ - PathToProperty.listIndex(1), - PathToProperty.mapKey(ref: 'list2'), - ], - ), - ).overrideWithValue(nullInstance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('list'), - ), - ), - ), - ), - ); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/collasped_list.png', - ), - ); - - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - 'list', - pathToProperty: [PathToProperty.listIndex(1)], - ), - ).notifier, - ) - .state = true; - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../test_infra/goldens/instance_viewer/expanded_list.png', - ), - ); - }); - - testWidgets('does not listen to unexpanded nodes', (tester) async { - final container = ProviderContainer( - overrides: [ - neverExpandedOverride, - instanceProvider(const InstancePath.fromInstanceId('list2')) - .overrideWithValue(list2Instance), - ], - ); - addTearDown(container.dispose); - - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('list2'), - ), - ), - ), - ), - ); - - expect( - container - .readProviderElement( - instanceProvider(const InstancePath.fromInstanceId('list2')), - ) - .hasListeners, - isTrue, - ); - expect( - container - .readProviderElement( - instanceProvider( - const InstancePath.fromInstanceId( - 'list2', - pathToProperty: [PathToProperty.listIndex(0)], - ), - ), - ) - .hasListeners, - isFalse, - ); - expect( - container - .readProviderElement( - instanceProvider( - const InstancePath.fromInstanceId( - 'list2', - pathToProperty: [PathToProperty.listIndex(1)], - ), - ), - ) - .hasListeners, - isFalse, - ); - }); - }); - - group('estimatedChildCountProvider', () { - group('primitives', () { - test('count for one line when not expanded', () { - final container = ProviderContainer( - overrides: [ - neverExpandedOverride, - instanceProvider(const InstancePath.fromInstanceId('string')) - .overrideWithValue(stringInstance), - instanceProvider(const InstancePath.fromInstanceId('null')) - .overrideWithValue(nullInstance), - instanceProvider(const InstancePath.fromInstanceId('bool')) - .overrideWithValue(trueInstance), - instanceProvider(const InstancePath.fromInstanceId('num')) - .overrideWithValue(int42Instance), - instanceProvider(const InstancePath.fromInstanceId('enum')) - .overrideWithValue(enumValueInstance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('string'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('null'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('bool'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('num'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('enum'), - ), - ), - 1, - ); - }); - - test('count for one line when expanded', () { - final container = ProviderContainer( - overrides: [ - // force expanded status - alwaysExpandedOverride, - instanceProvider(const InstancePath.fromInstanceId('string')) - .overrideWithValue(stringInstance), - instanceProvider(const InstancePath.fromInstanceId('null')) - .overrideWithValue(nullInstance), - instanceProvider(const InstancePath.fromInstanceId('bool')) - .overrideWithValue(trueInstance), - instanceProvider(const InstancePath.fromInstanceId('num')) - .overrideWithValue(int42Instance), - instanceProvider(const InstancePath.fromInstanceId('enum')) - .overrideWithValue(enumValueInstance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('string'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('null'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('bool'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('num'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('enum'), - ), - ), - 1, - ); - }); - }); - - group('lists', () { - test( - 'count for one line when not expanded regarless of the list length', - () { - final container = ProviderContainer( - overrides: [ - neverExpandedOverride, - instanceProvider(const InstancePath.fromInstanceId('empty')) - .overrideWithValue(emptyListInstance), - instanceProvider(const InstancePath.fromInstanceId('list-2')) - .overrideWithValue(emptyListInstance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('empty'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('list-2'), - ), - ), - 1, - ); - }, - ); - - test('when expanded, recursively traverse the list content', () { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('empty')) - .overrideWithValue(emptyListInstance), - // ['string', [42, true]] - instanceProvider(const InstancePath.fromInstanceId('list-2')) - .overrideWithValue(list2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list-2', - pathToProperty: [PathToProperty.listIndex(0)], - ), - ).overrideWithValue(stringInstance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list-2', - pathToProperty: [PathToProperty.listIndex(1)], - ), - ).overrideWithValue(list2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list-2', - pathToProperty: [ - PathToProperty.listIndex(1), - PathToProperty.listIndex(0), - ], - ), - ).overrideWithValue(int42Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'list-2', - pathToProperty: [ - PathToProperty.listIndex(1), - PathToProperty.listIndex(1), - ], - ), - ).overrideWithValue(trueInstance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('empty'), - ), - ), - 1, - ); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('list-2'), - ), - ), - // header + 2 items - 3, - ); - - // expand the nested list - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - 'list-2', - pathToProperty: [PathToProperty.listIndex(1)], - ), - ).notifier, - ) - .state = true; - - // now the estimatedChildCount traverse the nested list too - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('list-2'), - ), - ), - // header + string + sub-list header + sub-list 2 items - 5, - ); - }); - }); - - group('maps', () { - test( - 'count for one line when not expanded regarless of the map length', - () { - final container = ProviderContainer( - overrides: [ - neverExpandedOverride, - instanceProvider(const InstancePath.fromInstanceId('empty')) - .overrideWithValue(emptyMapInstance), - instanceProvider(const InstancePath.fromInstanceId('map-2')) - .overrideWithValue(map2Instance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('empty'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('map-2'), - ), - ), - 1, - ); - }, - ); - - test('when expanded, recursively traverse the map content', () { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('empty')) - .overrideWithValue(emptyMapInstance), - // {'string': 'string', [...]: [42, true]] - instanceProvider(const InstancePath.fromInstanceId('map-2')) - .overrideWithValue(map2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map-2', - pathToProperty: [PathToProperty.mapKey(ref: 'string')], - ), - ).overrideWithValue(stringInstance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map-2', - pathToProperty: [PathToProperty.mapKey(ref: 'list2')], - ), - ).overrideWithValue(list2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map-2', - pathToProperty: [ - PathToProperty.mapKey(ref: 'list2'), - PathToProperty.listIndex(0), - ], - ), - ).overrideWithValue(int42Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'map-2', - pathToProperty: [ - PathToProperty.mapKey(ref: 'list2'), - PathToProperty.listIndex(1), - ], - ), - ).overrideWithValue(trueInstance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('empty'), - ), - ), - 1, - ); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('map-2'), - ), - ), - // header + 2 items - 3, - ); - - // expand the nested list - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - 'map-2', - pathToProperty: [PathToProperty.mapKey(ref: 'list2')], - ), - ).notifier, - ) - .state = true; - - // now the estimatedChildCount traverse the nested list too - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('map-2'), - ), - ), - // header + string + sub-list header + sub-list 2 items - 5, - ); - }); - }); - - group('objects', () { - test( - 'count for one line when not expanded regarless of the number of fields', - () { - final container = ProviderContainer( - overrides: [ - neverExpandedOverride, - instanceProvider(const InstancePath.fromInstanceId('empty')) - .overrideWithValue(emptyObjectInstance), - instanceProvider(const InstancePath.fromInstanceId('object-2')) - .overrideWithValue(object2Instance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('empty'), - ), - ), - 1, - ); - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('object-2'), - ), - ), - 1, - ); - }, - ); - - test('when expanded, recursively traverse the object content', () { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('empty')) - .overrideWithValue(emptyObjectInstance), - // Class(first: 'string', second: [42, true]) - instanceProvider(const InstancePath.fromInstanceId('object-2')) - .overrideWithValue(object2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object-2', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'first', - ownerUri: '', - ownerName: '', - ), - ], - ), - ).overrideWithValue(stringInstance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object-2', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - ], - ), - ).overrideWithValue(list2Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object-2', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - PathToProperty.listIndex(0), - ], - ), - ).overrideWithValue(int42Instance), - instanceProvider( - const InstancePath.fromInstanceId( - 'object-2', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - PathToProperty.listIndex(1), - ], - ), - ).overrideWithValue(trueInstance), - ], - ); - addTearDown(container.dispose); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('empty'), - ), - ), - 1, - ); - - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('object-2'), - ), - ), - // header + 2 items - 3, - ); - - // expand the nested list - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - 'object-2', - pathToProperty: [ - PathToProperty.objectProperty( - name: 'second', - ownerUri: '', - ownerName: '', - ), - ], - ), - ).notifier, - ) - .state = true; - - // now the estimatedChildCount traverse the nested list too - expect( - container.read( - estimatedChildCountProvider( - const InstancePath.fromInstanceId('object-2'), - ), - ), - // header + string + sub-list header + sub-list 2 items - 5, - ); - }); - }); - }); - - group('isExpandedProvider', () { - test('the graph root starts as expanded', () { - final container = ProviderContainer(); - addTearDown(container.dispose); - - expect( - container - .read( - isExpandedProvider(const InstancePath.fromProviderId('0')) - .notifier, - ) - .state, - isTrue, - ); - - expect( - container - .read( - isExpandedProvider(const InstancePath.fromInstanceId('0')) - .notifier, - ) - .state, - isTrue, - ); - }); - - test('children nodes are not expanded by default', () { - final container = ProviderContainer(); - addTearDown(container.dispose); - - expect( - container - .read( - isExpandedProvider( - const InstancePath.fromProviderId( - '0', - pathToProperty: [PathToProperty.listIndex(0)], - ), - ).notifier, - ) - .state, - isFalse, - ); - - expect( - container - .read( - isExpandedProvider( - const InstancePath.fromInstanceId( - '0', - pathToProperty: [PathToProperty.listIndex(0)], - ), - ).notifier, - ) - .state, - isFalse, - ); - }); - }); -} - -// ignore: subtype_of_sealed_class, fake for testing. -class FakeEvalOnDartLibrary extends Fake implements EvalOnDartLibrary {} diff --git a/packages/devtools_app/test/test_infra/goldens/provider_screen/list_error_banner.png b/packages/devtools_app/test/test_infra/goldens/provider_screen/list_error_banner.png deleted file mode 100644 index 8887d559971..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/provider_screen/list_error_banner.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/provider_screen/no_selected_provider.png b/packages/devtools_app/test/test_infra/goldens/provider_screen/no_selected_provider.png deleted file mode 100644 index 5d7c34b4223..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/provider_screen/no_selected_provider.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/provider_screen/selected_provider.png b/packages/devtools_app/test/test_infra/goldens/provider_screen/selected_provider.png deleted file mode 100644 index 29a690ecae3..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/provider_screen/selected_provider.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/provider_screen/selected_provider_error_banner.png b/packages/devtools_app/test/test_infra/goldens/provider_screen/selected_provider_error_banner.png deleted file mode 100644 index 107174a24dd..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/provider_screen/selected_provider_error_banner.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/list_error_banner.png b/packages/devtools_app/test/test_infra/goldens/riverpod_screen/list_error_banner.png deleted file mode 100644 index c6544ae21c3..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/list_error_banner.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/no_selected_provider.png b/packages/devtools_app/test/test_infra/goldens/riverpod_screen/no_selected_provider.png deleted file mode 100644 index 5757489bf69..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/no_selected_provider.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/selected_provider.png b/packages/devtools_app/test/test_infra/goldens/riverpod_screen/selected_provider.png deleted file mode 100644 index e9622113fa7..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/selected_provider.png and /dev/null differ diff --git a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/selected_provider_error_banner.png b/packages/devtools_app/test/test_infra/goldens/riverpod_screen/selected_provider_error_banner.png deleted file mode 100644 index c1474a42e94..00000000000 Binary files a/packages/devtools_app/test/test_infra/goldens/riverpod_screen/selected_provider_error_banner.png and /dev/null differ