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