devicedtl 0.0.4 copy "devicedtl: ^0.0.4" to clipboard
devicedtl: ^0.0.4 copied to clipboard

Plugin to read device properties such Device model or brand,Your app version code/build code, Your device public IP

example/lib/main.dart

import 'package:devicedtl/device_detail.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(const DeviceDetailExample());
}

class DeviceDetailExample extends StatelessWidget {
  const DeviceDetailExample({Key? key}) : super(key: key);

  void Function()? getDeviceInfo() {
    return () async {
      /// Initialize Plugin
      final devicePropertiesPlugin = DeviceDetail();
      try {
        /// get all devices info
        var deviceInfo = await devicePropertiesPlugin.getDeviceInfo();
        print("your devices info detail :\n${deviceInfo?.toJson()}");

        /// only get your public ip
        var ipPublic = await devicePropertiesPlugin.getPublicIp();
        print("your devices ip public detail :\n$ipPublic");

        /// only get your device UUID
        var uuid = await devicePropertiesPlugin.getUUID();
        print("uuid device :\n${uuid}");
      } on PlatformException {
        /// Handle Error
        return;
      }
    };
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
          appBar: AppBar(title: const Text("DeviceInfoExample")),
          body: Center(
            child:
                ElevatedButton(onPressed: getDeviceInfo(), child: const Text("Get devices Info")),
          )),
    );
  }
}
0
likes
140
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

Plugin to read device properties such Device model or brand,Your app version code/build code, Your device public IP

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on devicedtl