vendredi 23 novembre 2018

Flutter: testing, MissingPluginException

I was testing some functions and everything was fine until I wrote a test for a function that contained a shared preferences object. Since then, my tests fail and even if I´ve deleted the one that "destroyed" everything, the error is still there:

Failed to load "flutterApp\test\test.dart": MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

package:flutter/src/services/platform_channel.dart 291:7
MethodChannel.invokeMethod ===== asynchronous gap =========================== package:shared_preferences/shared_preferences.dart 25:27
SharedPreferences.getInstance ===== asynchronous gap =========================== package:tracking_flutter/blocs/login_bloc.dart 237:38
LoginBloc.setPrefs ===== asynchronous gap =========================== package:tracking_flutter/blocs/login_bloc.dart 98:5
new LoginBloc test\test.dart 10:25
main ===== asynchronous gap =========================== package:test_api RemoteListener.start

I tried also to do flutter clean, but nothing happened.

This is my actual pubspec:

  cupertino_icons: ^0.1.2
  rxdart: ^0.19.0
  http: ^0.12.0
  shared_preferences: ^0.4.3
  mockito: ^4.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter

And flutter doctor:

> Doctor summary (to see all details, run flutter doctor -v): [√]
> Flutter (Channel beta, v0.11.9, on Microsoft Windows [Version
> 10.0.16299.666], locale en-150) [√] Android toolchain - develop for Android devices (Android SDK 28.0.3) [√] Android Studio (version 3.2)
> [√] IntelliJ IDEA Community Edition (version 2018.2) [√] IntelliJ IDEA
> Ultimate Edition (version 2017.3) [√] VS Code (version 1.28.2) [√]
> Connected device (1 available)
> 
> • No issues found!

Aucun commentaire:

Enregistrer un commentaire