obtenerModelo function

Future<void> obtenerModelo(
  1. DeviceProvider dp
)

This function is used to obtain the model of the device the app is being launched in It requires as an argument the DeviceProvider to call DeviceProvider.setDeviceModel

Implementation

Future<void> obtenerModelo(DeviceProvider dp) async {
  final deviceInfo = DeviceInfoPlugin();

  if (Platform.isAndroid) {
    final info = await deviceInfo.androidInfo;
    print('Modelo: ${info.model}');
    print('Marca: ${info.brand}');
    print('Android: ${info.version.release}');
    dp.setDeviceModel( '${info.model}' + '${info.brand}' + '${info.version.release}');
  } else if (Platform.isIOS) {
    final info = await deviceInfo.iosInfo;
    print('Modelo: ${info.utsname.machine}');
    print('Nombre: ${info.name}');
    print('iOS: ${info.systemVersion}');
    dp.setDeviceModel( '${info.utsname.machine}' + '${info.name}' + '${info.systemVersion}');
  }
}