init static method

Future<void> init()

Implementation

static Future<void> init() async {
  documentsPath = (await getApplicationDocumentsDirectory()).path;
  dioCachePath = (await getApplicationSupportDirectory()).path;
  temporaryPath = (await getTemporaryDirectory()).path;
  final dataYaml = await rootBundle.loadString("pubspec.yaml");
  final yaml = loadYaml(dataYaml);
  appVersion = yaml["version"];

  final deviceInfo = DeviceInfoPlugin();
  if (Platform.isIOS) {
    final iosDeviceInfo = await deviceInfo.iosInfo;
    deviceId = iosDeviceInfo.identifierForVendor ?? '';
    deviceName = iosDeviceInfo.name;
    platform = 'ios';
  } else {
    final androidDeviceInfo = await deviceInfo.androidInfo;
    deviceId = androidDeviceInfo.id;
    deviceName = androidDeviceInfo.name;
    platform = 'android';
  }
}