I have a flutter App and I am writing a test case that compares the currentVersion of the App with the latestVersion available. The function simply takes values for currentVersion and latestVersion and returns true or false depending on whether currentVersion<=latestVersion.
I am using get_version plugin to extract the currentVersion of the App. LatestVersion holds a value one than that for testing purposes.
This same call works in the rest of the App. It's creating an issue only in the test case.
I tried upgrading from 0.0.8 to 0.1.0 but in vain.
....
void main() {
test('checkAppVersion', () async {
String currentVersion = await GetVersion.projectVersion;
....
expect( checkAppVersionTest( Version.parse(currentVersion), Version.parse(latestVersion)), true);
.....
}); }
....
bool checkAppVersionTest(Version currentVersion, Version latestVersion) { bool updateRequired = false;
if (currentVersion < latestVersion) {
updateRequired = true;
}
return updateRequired;
}
I am getting the following 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
Works fine when I hard code the currentVersion value.
Please suggest a way around this.
Aucun commentaire:
Enregistrer un commentaire