flutter_facilityinfo 0.1.3
flutter_facilityinfo: ^0.1.3 copied to clipboard

A new Flutter plugin.

flutter_facilityinfo #

A new Flutter plugin.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[Usage] Import package:flutter_facilityinfo/flutter_facilityinfo.dart, instantiate PhonePlug and use the Android and iOS getters to get platform-specific device information.


Example: #

使用此插件可获取安卓手机的  IMEI  MAC  UUID  

此方法具有获取信息的优先级  也可自行获取并设置
首先获取 IMEI  如为空 则获取 MAC  如为空 则获取UUID

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
引入 permission_handler: ^3.2.2

 Future<Null> _prepare() async {
    isAlow = await _checkPermission();
    if (isAlow) {
    } else {
// 检查权限
  Future<bool> _checkPermission() async {
    if (Platform.isAndroid) {
      PermissionStatus permission = await PermissionHandler()
      if (permission != PermissionStatus.granted) {
        Map<PermissionGroup, PermissionStatus> permissions =
            await PermissionHandler()
        if (permissions[PermissionGroup.phone] == PermissionStatus.granted) {
          return true;
      } else {
        return true;
    } else {
      return true;
    return false;

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter_facilityinfo/flutter_facilityinfo.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  String _deviceid = 'Unknown';

  void initState() {

  Future<void> initDeviceId() async {
    String deviceid;

    deviceid = await FlutterPhoneinfo.getIdentifier;
   String mac=await FlutterPhoneinfo.getMac;
   String uuid=await FlutterPhoneinfo.getUUID;
    if (!mounted) return;

    setState(() {
      _deviceid = 'deviceid:  $deviceid';

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Device Id example app'),
        body: new Center(
          child: new Text('$_deviceid'),