Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
9a98dce
Add shared preferences devtools
adsonpleal May 21, 2024
f6a1ce9
Add docs
adsonpleal May 21, 2024
b9c0b6b
change version constraint
adsonpleal May 21, 2024
e2f1478
update readme
adsonpleal May 21, 2024
b798091
pr requested changes
adsonpleal May 21, 2024
0115bea
fix broken test
adsonpleal May 21, 2024
421d981
remove icons from manifest
adsonpleal May 22, 2024
bf23f70
Use InheritedModel to avoid unnecessary rebuilds
adsonpleal May 23, 2024
2402e78
change search bar
adsonpleal May 23, 2024
215d551
PR requested changes
adsonpleal May 24, 2024
18ac82b
Fix wrong change
adsonpleal May 24, 2024
16f30fc
add TestOn annotations
adsonpleal May 24, 2024
c14409e
lint fix and update dependencies
adsonpleal May 24, 2024
382f612
revert vm_service version change
adsonpleal May 24, 2024
aba50c5
fix licenses
adsonpleal May 24, 2024
a118924
solve some CI checks
adsonpleal May 27, 2024
0604550
Add web unavailable message
adsonpleal May 28, 2024
eb6dc64
Add codeowners and allowed unpinned deps
adsonpleal May 28, 2024
c9dab29
PR requested changes
adsonpleal May 28, 2024
1627ec8
update codeowners
adsonpleal May 28, 2024
c7c3eb5
fix typo
adsonpleal May 28, 2024
bb58727
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal May 28, 2024
ee1d2f4
Remove chared preferences changes and change codeowners
adsonpleal Jun 18, 2024
01d7f5c
Remove asyncEval call
adsonpleal Jun 18, 2024
39b3990
remove commented code
adsonpleal Jun 18, 2024
00e568c
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Jun 18, 2024
21202e6
pr requested changes
adsonpleal Jun 18, 2024
e489086
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Jun 20, 2024
c32457f
Merge branch 'main' into add-shared-preferences-devtools
stuartmorgan-g Jun 21, 2024
c6c8068
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Jun 24, 2024
c4be218
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Jul 29, 2024
862938b
Add pre_publish.dart and extension config.yaml to shared_preferences
adsonpleal Jul 29, 2024
84c6103
fix changelog and license validations
adsonpleal Jul 29, 2024
866ef50
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Jul 31, 2024
7b1a151
Support new API and update changelog
adsonpleal Aug 1, 2024
bffbe95
also update the version in pubspec
adsonpleal Aug 1, 2024
d8af525
Merge remote-tracking branch 'origin/main' into add-shared-preference…
adsonpleal Aug 1, 2024
26f186b
revert changes to pubspec
adsonpleal Aug 1, 2024
8b005d9
add empty line back to pubspec
adsonpleal Aug 1, 2024
2dc2a33
update minor version
adsonpleal Aug 1, 2024
5b7cbbf
Fix android support
adsonpleal Aug 2, 2024
c497026
Add api switcher
adsonpleal Aug 2, 2024
bc887de
add missing license
adsonpleal Aug 2, 2024
ffd64a9
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Aug 5, 2024
e95d285
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Aug 5, 2024
ed56a14
resolve conflicts
adsonpleal Aug 8, 2024
8936da6
Merge branch 'add-shared-preferences-devtools' of github.com:adsonple…
adsonpleal Aug 8, 2024
966d0fc
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Aug 9, 2024
3267c1b
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Aug 12, 2024
1acebd4
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Aug 12, 2024
3846f73
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Aug 15, 2024
6eb1b4f
Merge remote-tracking branch 'origin/main' into add-shared-preference…
adsonpleal Aug 15, 2024
d3fea9e
Merge branch 'flutter:main' into add-shared-preferences-devtools
adsonpleal Sep 2, 2024
af0dfca
Add devtool_eval_test to shared_preferences
adsonpleal Sep 2, 2024
107fc82
apply requested changes to devtools_eval_test
adsonpleal Sep 5, 2024
4b2f619
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Sep 5, 2024
6abec8a
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Sep 30, 2024
a45bc1c
Add license header to devtools_eval_test
adsonpleal Sep 30, 2024
c1a9c85
Update libraries
adsonpleal Sep 30, 2024
612e118
Merge branch 'add-shared-preferences-devtools' of github.com:adsonple…
adsonpleal Sep 30, 2024
ea80fce
remove error holder
adsonpleal Sep 30, 2024
1ef04f6
remove error holder
adsonpleal Sep 30, 2024
4df0393
replace text with circular progress indicator
adsonpleal Oct 1, 2024
2f8e7ea
fix broken test
adsonpleal Oct 1, 2024
b77893c
Apply suggested changes
adsonpleal Oct 7, 2024
7a3ec34
Merge remote-tracking branch 'origin/main' into add-shared-preference…
adsonpleal Nov 6, 2024
e9b913c
add devtools_extension.dart file
adsonpleal Nov 7, 2024
8362269
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Nov 7, 2024
119df62
update pre_publish.dart
adsonpleal Nov 7, 2024
38954ba
pin vm service version
adsonpleal Nov 8, 2024
e3c39f2
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Nov 8, 2024
9f7cdd4
Fix mockito generated code
adsonpleal Nov 8, 2024
026b225
Merge branch 'add-shared-preferences-devtools' of github.com:adsonple…
adsonpleal Nov 8, 2024
659b9cd
Change vm_service version
adsonpleal Nov 8, 2024
7bd20c1
Merge remote-tracking branch 'origin/main' into add-shared-preference…
adsonpleal Nov 11, 2024
d672329
add missing license
adsonpleal Nov 11, 2024
e6da5b8
add path as a dev_dependency
adsonpleal Nov 11, 2024
3c5cecd
change path version
adsonpleal Nov 11, 2024
c761404
requested changes
adsonpleal Nov 12, 2024
2b7d31f
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Nov 12, 2024
c80795a
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Nov 22, 2024
bb0b9be
rename lib/src/shared_preferences_dev_tools_extension_data.dart to li…
adsonpleal Nov 22, 2024
4f6e93b
Merge branch 'add-shared-preferences-devtools' of github.com:adsonple…
adsonpleal Nov 22, 2024
4f2d2fd
rename test file
adsonpleal Nov 22, 2024
9838731
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Nov 27, 2024
a783959
Merge branch 'main' into add-shared-preferences-devtools
adsonpleal Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove asyncEval call
  • Loading branch information
adsonpleal committed Jun 18, 2024
commit 01d7f5c25a70bbe41ed7d87b1fe51017127dadda
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class SharedPreferencesState {
this.allKeys = const <String>[],
this.selectedKey,
this.editing = false,
this.isWebPlatform = false,
});

/// A list of all keys in the shared preferences of the target debug session.
Expand All @@ -30,9 +29,6 @@ class SharedPreferencesState {
/// Whether the user is editing the value of the selected key.
final bool editing;

/// Whether the current target debug session's platform is web or not.
final bool isWebPlatform;

/// Creates a copy of this [SharedPreferencesState] but replacing the given
/// fields with the new values.
SharedPreferencesState copyWith({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// 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/material.dart';

import 'async_state.dart';
Expand All @@ -18,11 +17,9 @@ class SharedPreferencesStateNotifier extends ValueNotifier<_State> {
/// You don't need to call this constructor directly. Use [SharedPreferencesStateNotifierProvider] instead.
SharedPreferencesStateNotifier(
this._eval,
this._connectedApp,
) : super(const _State.loading());

final SharedPreferencesToolEval _eval;
final ConnectedApp? _connectedApp;

List<String> _keys = <String>[];

Expand All @@ -32,13 +29,13 @@ class SharedPreferencesStateNotifier extends ValueNotifier<_State> {
Future<void> fetchAllKeys() async {
value = const _State.loading();
try {
final bool isWebPlatform = await _connectedApp?.isDartWebApp ?? false;
if (isWebPlatform) {
value = const _State.data(SharedPreferencesState(
isWebPlatform: true,
));
return;
}
// final bool isWebPlatform = await _connectedApp?.isDartWebApp ?? false;
// if (isWebPlatform) {
// value = const _State.data(SharedPreferencesState(
// isWebPlatform: true,
// ));
// return;
// }

_keys = await _eval.fetchAllKeys();
value = _State.data(SharedPreferencesState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ enum _StateInheritedModelAspect {
selectedKey,
selectedKeyData,
editing,
isWebPlatform,
}

/// An inherited model that provides a [SharedPreferencesState] to its descendants.
Expand Down Expand Up @@ -74,8 +73,6 @@ class _SharedPreferencesStateInheritedModel
state.selectedKeyDataState != oldWidget.state.selectedKeyDataState,
_StateInheritedModelAspect.editing =>
state.editingState != oldWidget.state.editingState,
_StateInheritedModelAspect.isWebPlatform =>
state.isWebPlatform != oldWidget.state.isWebPlatform,
},
);
}
Expand All @@ -101,8 +98,6 @@ extension on AsyncState<SharedPreferencesState> {
);

bool get editingState => dataOrNull?.editing ?? false;

bool get isWebPlatform => dataOrNull?.isWebPlatform ?? false;
}

@visibleForTesting
Expand Down Expand Up @@ -225,22 +220,6 @@ class SharedPreferencesStateProvider extends StatefulWidget {
.editingState;
}

/// Returns whether the target debug session is a web platform from the closest
/// _SharedPreferencesStateInheritedModel ancestor.
///
/// Use of this method will cause the given [context] to rebuild whenever the
/// platform changes.
/// This will not cause a rebuild when any other part of the state changes.
static bool isWebPlatformOf(BuildContext context) {
return context
.dependOnInheritedWidgetOfExactType<
_SharedPreferencesStateInheritedModel>(
aspect: _StateInheritedModelAspect.isWebPlatform,
)!
.state
.isWebPlatform;
}

/// The required child widget.
final Widget child;

Expand All @@ -262,10 +241,7 @@ class _SharedPreferencesStateProviderState
serviceManager: serviceManager,
);
final SharedPreferencesToolEval toolEval = SharedPreferencesToolEval(eval);
_notifier = SharedPreferencesStateNotifier(
toolEval,
serviceManager.connectedApp,
);
_notifier = SharedPreferencesStateNotifier(toolEval);
_notifier.fetchAllKeys();
}

Expand Down
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kenzieschmoll I have an idea on how to create an integration test for this class, but I'm stuck on a step and would like to know if you have any tips.

Basically, I want to do the following:

  • Create a standard integration test.
  • Mock the SharedPreferencesAsyncPlatform and SharedPreferencesStorePlatform. This will allow me to check if the SharedPreferencesToolEval is calling the right methods.
  • Connect dtdManager to the debug session (yes, the test would connect to its own debug session; I've tested it with a running devtools, and it works fine).
  • Perform the checks.

I'm actually stuck on the part where I'd use dtdManager to connect to its own debug session. The problem is that I can't figure out a way to get the debug service uri programmatically. I've tried Service.getInfo() from 'dart:developer', but it doesn't work on the web. I keep getting this error: Unsupported operation: dart:isolate is not supported on dart4web.

Here is a code example of what I want to do:

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  group('SharedPreferencesToolEval integration', () {
    testWidgets('should work', (tester) async {
      /// Just so dtdManager and serviceManager get initialized
      await tester.pumpWidget(
        DevToolsExtension(
          child: Container(),
        ),
      );

      // This is the issue, I can't find a way to get the 
      // debug session uri programmatically.
      final info = await Service.getInfo();
      final uri = info.serverUri!;

      await dtdManager.connect(uri);

      final EvalOnDartLibrary asyncEval = EvalOnDartLibrary(
        'package:shared_preferences/src/shared_preferences_async.dart',
        serviceManager.service!,
        serviceManager: serviceManager,
      );
      final EvalOnDartLibrary legacyEval = EvalOnDartLibrary(
        'package:shared_preferences/src/shared_preferences_legacy.dart',
        serviceManager.service!,
        serviceManager: serviceManager,
      );
      final SharedPreferencesToolEval toolEval = SharedPreferencesToolEval(
        asyncEval,
        legacyEval,
        serviceManager.connectedApp?.isFlutterWebAppNow ?? false,
      );

      // Do the testing here
    });
  });
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I knew the debug session uri I could even do a normal connection using the UI (driving the test to type the url and click the connect button), so I can call updateVmServiceConnection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of issues here:

  1. "Unsupported operation: dart:isolate is not supported on dart4web" - this is correct. dart:isolate is not available on the web, and since devtools_extensions is a web-only package, it will not be possible to use dart:isolate from the context of this web integration test.
  2. The DTD uri and the VM service URI are two different things. The Dart Tooling Daemon (DTD) is a long running daemon that is started by the user's IDE and passed along to DevTools and then DevTools extensions. This is not relevant for expression evaluations, as it is completely independent of the running app where the evaluation will take place. The VM Service URI is the URI for the connected application, which is what the serviceManager needs to be connected to in order to perform evaluations.

Right now, this behavior is going to be quite difficult to test, but this is something I'd like to improve for the DevTools extensions framework in general because testing compatibility with the parent package is an important use case. That being said, I recommend following the advice from this comment to test the evaluated expressions, and we can add full integration testing later when that is better supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but if we go with this approach of editing the shared_preferences package we might as well create a dedicated devtool.dart file just like provider does. This way we could move all the expressions to this file and simplify the SharedPreferencesToolEval class to just call this devtool.dart file.

It would be way easier and we'd make sure that the contract is working, since the devtool.dart would be the contract itself.

I was deliberately not making changes in shared_preferences, though. But if we feel comfortable on doing this it would be way easier than trying to hack an integration test.

With this approach, we could just have the devtool.dart file living in the src folder, without reference in shared_preferences.dart. This way tree shaking would remove it from production builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could even remove this hack, since it would be possible to use developer.postEvent from within devtool.dart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Well, we can go with this idea, but this PR was kind already done and tested. If we want to go with the devtools_extension.dart approach I'll need to do some refactor at it would change about 20% of the current code. This is fine, it would just delay the merge a bit more.

Do you think this issue will be prioritized soon? With integration tests I think we should keep the current eval solution, since it would keep the shared_preferences package simpler.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this flutter/devtools#8210 will be prioritized soon? With integration tests I think we should keep the current eval solution, since it would keep the shared_preferences package simpler.

No I don't think this will be prioritized soon with our current resourcing and priorities.

That being said, I'm okay with implementing the devtools_extension.dart changes as a follow up PR after landing this one. This will simplify the extension code and make the evals safer for the long term of the tool. This also would allow us to support web targets.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan will the publish of shared_preferences happen automatically since this PR includes a version bump? If so, is there a way to delay the publish of shared_preferences until after the follow up PR I am referencing in my previous comment can be implemented and landed? If not, it isn't a big deal to implement the follow up PR with a patch version bump to 2.4.1.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan will the publish of shared_preferences happen automatically since this PR includes a version bump?

Yes, any version change will trigger publishing.

If so, is there a way to delay the publish of shared_preferences until after the follow up PR I am referencing in my previous comment can be implemented and landed?

It's possible, yes. This PR would have to:

  • Not change the shared_preferences version.
  • Mark shared_preferences as unpublishable with a reference issue, to prevent some random unrelated change to shared_preferences that follows the usual process from accidentally publishing the intermediate state.

And then no fixes to shared_preferences could be made until that follow-up was resolved.

Generally we only use this for batching breaking changes in a singe major version bump, because blocking all other changes on something unrelated is the opposite of how we generally want our release process to work. I'm not sure I follow why it would be needed here. If we think there is a change we should make to make what this PR is doing a) simpler and b) safer, why wouldn't we make that change before landing the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we can do on this PR then. I'll work on the devtools_extension.dart and push the changes to the current PR. @kenzieschmoll it will just take a while, since I need to re-work some parts of the code. I expect to be able to finish it by mid next week.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: missing_whitespace_between_adjacent_strings

import 'package:devtools_app_shared/service.dart';
import 'package:vm_service/vm_service.dart';

Expand Down Expand Up @@ -116,10 +118,59 @@ class SharedPreferencesToolEval {
}

extension on EvalOnDartLibrary {
/// Evaluates the given [method] on the shared preferences instance.
///
/// Returns the [InstanceRef] of the result.
/// The [isAlive] parameter is used to dispose the evaluation if the
/// caller is disposed.
///
/// This method is actually a workaround for the asyncEval method, which is
/// not working for web targets.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you link the bug here?

Future<InstanceRef> prefsEval(String method, Disposable? isAlive) async {
return (await asyncEval(
'(await SharedPreferences.getInstance()).$method',
// Create a empty list in memory to hold the shared preferences instance.
// It could've been anything that can handle values passed by reference.
final InstanceRef prefsHolderRef = await safeEval(
'[]',
isAlive: isAlive,
);

// Add the shared preferences instance to the list once the future completes
await eval(
'SharedPreferences.getInstance().then(prefsHolder.add);',
scope: <String, String>{
'prefsHolder': prefsHolderRef.id!,
},
isAlive: isAlive,
);

InstanceRef? prefsRef;
// The maximum number of retries to get the shared preferences instance.
// Means a max of 1 second of waiting.
const int maxRetries = 20;
int retryCount = 0;

// Wait until the shared preferences instance is added to the list.
while (prefsRef == null) {
retryCount++;
// A break condition to avoid infinite loop.
if (retryCount > maxRetries) {
throw StateError('Failed to get shared preferences instance.');
}
final Instance holderInstance =
await safeGetInstance(prefsHolderRef, isAlive);
final dynamic prefsInstance = holderInstance.elements?.firstOrNull;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use Object? here?

prefsRef = prefsInstance != null ? prefsInstance as InstanceRef : null;
if (prefsRef == null) {
await Future<void>.delayed(const Duration(milliseconds: 50));
}
}

return (await eval(
'prefs.$method',
isAlive: isAlive,
scope: <String, String>{
'prefs': prefsRef.id!,
},
))!;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// found in the LICENSE file.

import 'package:devtools_app_shared/ui.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

import '../shared_preferences_state_provider.dart';
import 'data_panel.dart';
import 'keys_panel.dart';

Expand All @@ -19,14 +16,6 @@ class SharedPreferencesBody extends StatelessWidget {

@override
Widget build(BuildContext context) {
final bool isWebPlatform = SharedPreferencesStateProvider.isWebPlatformOf(
context,
);

if (isWebPlatform) {
return const _WebUnavailableMessage();
}

final Axis splitAxis = SplitPane.axisFor(context, 0.85);

return SplitPane(
Expand All @@ -39,48 +28,3 @@ class SharedPreferencesBody extends StatelessWidget {
);
}
}

class _WebUnavailableMessage extends StatelessWidget {
const _WebUnavailableMessage();

@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);

return Center(
child: Container(
width: 400.0,
padding: const EdgeInsets.all(largeSpacing),
child: Text.rich(
textAlign: TextAlign.center,
TextSpan(
children: <InlineSpan>[
TextSpan(
text: 'The shared preferences tool is not available for web '
'platforms yet. Once this ',
style: theme.regularTextStyle,
),
TextSpan(
text: 'issue',
style: theme.linkTextStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
Uri.parse(
'https://github.com/flutter/devtools/issues/7766',
),
);
},
),
TextSpan(
text: ' is resolved, this tool will be updated to support web '
'platforms.',
style: theme.regularTextStyle,
),
],
),
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies:
devtools_extensions: ^0.1.1
flutter:
sdk: flutter
url_launcher: ^6.2.6
vm_service: ^14.2.1

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import 'shared_preferences_state_notifier_test.mocks.dart';
void main() {
group('SharedPreferencesStateNotifier', () {
late MockSharedPreferencesToolEval evalMock;
late MockConnectedApp connectedApp;
late SharedPreferencesStateNotifier notifier;

setUpAll(() {
Expand All @@ -29,20 +28,7 @@ void main() {

setUp(() {
evalMock = MockSharedPreferencesToolEval();
connectedApp = MockConnectedApp();
when(connectedApp.isDartWebApp).thenAnswer((_) async => false);
notifier = SharedPreferencesStateNotifier(evalMock, connectedApp);
});

test('should set isWebPlatform value from connectedApp', () async {
for (final bool value in <bool>[true, false]) {
when(connectedApp.isDartWebApp).thenAnswer((_) async => value);
await notifier.fetchAllKeys();
expect(
notifier.value.dataOrNull!.isWebPlatform,
equals(value),
);
}
notifier = SharedPreferencesStateNotifier(evalMock);
});

test('should start in the loading state', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ library;

import 'package:devtools_extensions/devtools_extensions.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:shared_preferences_tool/src/async_state.dart';
import 'package:shared_preferences_tool/src/shared_preferences_state.dart';
import 'package:shared_preferences_tool/src/shared_preferences_state_provider.dart';
import 'package:shared_preferences_tool/src/ui/data_panel.dart';
import 'package:shared_preferences_tool/src/ui/keys_panel.dart';
Expand Down Expand Up @@ -39,37 +36,5 @@ void main() {
expect(find.byType(DataPanel), findsOneWidget);
},
);

testWidgets(
'should show web unavailable message when running on web',
(WidgetTester tester) async {
final MockSharedPreferencesStateNotifier notifier =
MockSharedPreferencesStateNotifier();
when(notifier.value).thenReturn(
const AsyncState<SharedPreferencesState>.data(
SharedPreferencesState(
isWebPlatform: true,
),
),
);

await tester.pumpWidget(
DevToolsExtension(
requiresRunningApplication: false,
child: InnerSharedPreferencesStateProvider(
notifier: notifier,
child: const SharedPreferencesBody(),
),
),
);

expect(
find.textContaining(
'The shared preferences tool is not available for web',
),
findsOneWidget,
);
},
);
});
}