device_information
一个 Flutter 插件,用于获取设备信息,例如设备 IMEI 号码、型号名称、API 级别、CPU 类型、产品名称等,适用于 Android 和 iOS。
Hina-Hussain/DeviceInformationPlugin open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
A flutter plugin to get device information such as device IMEI number, model name, API level,CPU Type,Product Name etc for both android & iOS.
Add following dependency in pubspec.yaml file:
device_information:^0.0.4
Install by running:
$ flutter pub get
import 'package:device_information/device_information.dart';
try {
platformVersion = await DeviceInformation.platformVersion;
imeiNo = await DeviceInformation.deviceIMEINumber;
modelName = await DeviceInformation.deviceModel;
manufacturer = await DeviceInformation.deviceManufacturer;
apiLevel = await DeviceInformation.apiLevel;
deviceName = await DeviceInformation.deviceName;
productName = await DeviceInformation.productName;
cpuType = await DeviceInformation.cpuName;
hardware = await DeviceInformation.hardware;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
In android add the following permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Then for API targetting from Marshmallow, need to request runtime permissions. Although in iOS there is no need to specify permissions.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Hina Hussain & her team members (Kamran Khan, Abdul Sattar, Faiza Farooqui) :smile: :tada:
https://hina-hussain-developer.medium.com/creating-publisher-account-on-the-pub-dev-cf86b91cd2f https://hinahussaindev.blogspot.com/2021/05/creating-publisher-account-on-pubdev.html
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗