Flutter - widget test never finishes on Linux

Viewed 167

I use Flutter on Linux(Ubuntu). I created simply Linux desktop app. Also I created test widget, but I have issue. I have two user case: first I run my application. after that I run the test, I always get the error:

   /home/ubuntu/snap/flutter/common/flutter/bin/flutter --no-color test --machine --start- 
   paused 
   test/widget_test.dart
   Testing started at 10:00 AM ...

   package:flutter_tools/src/test/flutter_tester_device.dart 224:73  
   FlutterTesterTestDevice.finished
   ===== asynchronous gap ===========================
   dart:async/future.dart                                            Future.any.onValue

   Failed to load "/home/ubuntu/StudioProjects/my-flutter/test/widget_test.dart": Shell 
   subprocess ended cleanly. Did main() call exit()?

For fix it I running these commands :

   flutter clean
   flutter pub get

I run test(two user case) but it never ends - infinite loading indicator

enter image description here

This is my code, it working on Windows:

 testWidgets('Counter increments smoke test', (WidgetTester tester) 
  async 
  {
   final pref = await SharedPreferences.getInstance();
   await tester.pumpWidget(ProviderScope(overrides: [
   settingsProvider.overrideWithValue(
    SettingsService(pref),
   ),
  ], child: const MyApp()));
  expect(find.text('1'), findsNothing);

 });

is it possible to fix this?

0 Answers
Related