I need to retrieve the app version from within Dart code in a Flutter project.
I am using package_info and in Android is working OK but in iOS the version property in PackageInfo is null.
My code:
Future<String> getVersion() async {
String base = getText(version);
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return base.replaceAll("[name]", packageInfo.version);
}
Any help why is happening this or other way to retrieve the version? In some places of internet it is said that the version must be retrieved from native config files but in my case those files contains a reference to the version defined in pubspec.yaml.
I am using Flutter version 1.0.0
Thanks.