init method

Future<void> init()

Initialize the device info using the DeviceInfoPlugin.

Implementation

Future<void> init() async {
  // early out if already initialized
  if (deviceData.isNotEmpty) return;

  try {
    if (Platform.isAndroid) {
      deviceData =
          _readAndroidDeviceInfo(await _deviceInfoPlugin.androidInfo);
    } else if (Platform.isIOS) {
      deviceData = _readIosDeviceInfo(await _deviceInfoPlugin.iosInfo);
    }
  } on Exception {
    deviceData = {};
  }
}