getDeviceInfo method

Future<bool> getDeviceInfo()

Implementation

Future<bool> getDeviceInfo() async {
  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
  if (Platform.isAndroid) {
    androidDeviceInfo = await deviceInfo.androidInfo;
  } else if (Platform.isIOS) {
    iosDeviceInfo = await deviceInfo.iosInfo;
    FlutterSecureStorage storage = const FlutterSecureStorage();
    Address.appId = await storage.read(key: Address.iosId);
    if (Address.appId?.isEmpty != false) {
      Address.appId = iosDeviceInfo.identifierForVendor;
      storage.write(key: Address.iosId, value: Address.appId);
    }
  }
  packageInfo = await PackageInfo.fromPlatform();
  return true;
}