device_info_plus (10.0.1)

Published 2023-10-10 15:49:05 +01:00 by MrStubbly

Installation

dart pub add device_info_plus:10.0.1 --hosted-url=

About this package

Flutter plugin providing detailed information about the device (make, model, etc.), and Android or iOS version the app is running on.

device_info_plus

Flutter Community: device_info_plus

pub package
pub points
device_info_plus

build

Get current device information from within the Flutter application.

Platform Support

Android iOS MacOS Web Linux Windows

Usage

Import package:device_info_plus_cdocdevice_info_plus.dart, instantiate DeviceInfoPlugin
and use the Android and iOS, Web getters to get platform-specific device
information.

Example:

import 'package:device_info_plus_cdocdevice_info_plus.dart';

DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
print('Running on ${androidInfo.model}');  // e.g. "Moto G (4)"

IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
print('Running on ${iosInfo.utsname.machine}');  // e.g. "iPod7,1"

WebBrowserInfo webBrowserInfo = await deviceInfo.webBrowserInfo;
print('Running on ${webBrowserInfo.userAgent}');  // e.g. "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0"

The plugin provides a data method that returns platform-specific device
information in a generic way, which can be used for crash-reporting purposes.

However, the data provided by this data method is currently not serializable
(i.e. it is not 100% JSON compatible) and shouldn't be treated as such.

import 'package:device_info_plus_cdocdevice_info_plus.dart';

final deviceInfoPlugin = DeviceInfoPlugin();
final deviceInfo = await deviceInfoPlugin.deviceInfo;
final allInfo = deviceInfo.data;

Note

To get serial number on Android your app needs to meet one of official requirements
In case the app doesn't meet any of requirements plugin will return unknown.

Learn more

Details
Pub
2023-10-10 15:49:05 +01:00
7
268 KiB
Assets (1)
10.0.1.tar.gz 268 KiB
Versions (1) View all
10.0.1 2023-10-10