getPackageInfo static method Null safety

Future<PackageInfo?> getPackageInfo()

Lazyload package info instance

Implementation

static Future<PackageInfo?> getPackageInfo() async {
  _packageInfo ??= await PackageInfo.fromPlatform();

  debugPrint('App Name: ${_packageInfo!.appName}\n'
      'Package Name: ${_packageInfo!.packageName}\n'
      'Version: ${_packageInfo!.version}\n'
      'Build Number: ${_packageInfo!.buildNumber}');

  return _packageInfo;
}