getAppVersion function

Future<VersionModel> getAppVersion()

Return the current version of the app

VersionModel model = await getAppVersion();
print(model.version);
print(model.buildNumber);

Implementation

Future<VersionModel> getAppVersion() async {
  PackageInfo packageInfo = await PackageInfo.fromPlatform();
  String version = packageInfo.version;
  String buildNumber = packageInfo.buildNumber;

  return VersionModel(version, buildNumber);
}