2
votes

I'm trying to write a test for my flutter App. The function for which I am writing the test returns a Future, therefore I am using await.

But as soon as any await statement is used I get the MissingPluginException Error.

I tried changing dependency version, but it doesn't help. Could not find anything on GitHub for Flutter Issues or StackOverFlow regarding this.

check_app_version_test.dart

import 'package:flutter_test/flutter_test.dart';

import '../home.dart';

void main() {
  test('checkAppVersion', () async {
    expect(await checkAppVersionTest(true), true);
  });
}

home.dart

String currentVersionString = await GetVersion.projectVersion;
Version currentVersion = Version.parse(currentVersionString);

Future<bool> checkAppVersionTest([bool test, Version latestVersion]) async {

...
  if (currentVersion < latestVersion) {
    updateRequired = true;
  }
...
return updateRequired

}

expected to work fine.

Getting error:

MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/package_info)
package:flutter/src/services/platform_channel.dart 300:7 MethodChannel.invokeMethod ===== asynchronous gap =========================== dart:async _AsyncAwaitCompleter.completeError package:flutter/src/services/platform_channel.dart
MethodChannel.invokeMethod ===== asynchronous gap =========================== dart:async _asyncThenWrapperHelper package:flutter/src/services/platform_channel.dart
MethodChannel.invokeMethod package:package_info/package_info.dart 38:17 PackageInfo.fromPlatform

2

2 Answers

0
votes

Just terminate the app and hot restart the app. As you added a dependency which requires a platform specific code to run through platform channel. You have to restart the app by terminating the current one.

-1
votes

Looks like you simply have to install your pods.
Open up a terminal and navigate to your flutter directory.
CD into the iOS directory via cd iOS/ and then run pod install

Now you should be able to run the project just fine.