flutter_device_inspector 0.0.1
flutter_device_inspector: ^0.0.1 copied to clipboard
A Flutter plugin to inspect device details like model, RAM, CPU info, OS version, and more.
Flutter Device Inspector 🔍 #
A premium Flutter plugin for retrieving detailed hardware and software specifications from a device. It provides a simple, unified API to access unique device identifiers, RAM, CPU details, and more.
🚀 Features #
- Unique Device ID: Get a persistent unique identifier for the device.
- Hardware Specs: Retrieve total RAM (GB), Total Storage (MB), and CPU information.
- Device Identity: Get Model, Brand, and Manufacturer details.
- OS Information: Access the current operating system version.
- Unified Model: Fetch all data at once using the
DeviceInfomodel.
📦 Installation #
Add this to your pubspec.yaml:
dependencies:
flutter_device_inspector: ^0.0.1
Then run:
flutter pub get
🛠 Usage #
1. Import the package #
import 'package:flutter_device_inspector/flutter_device_inspector.dart';
2. Get All Device Info (Recommended) #
DeviceInfo info = await FlutterDeviceInspector.getFullInfo();
print('Device ID: ${info.deviceId}');
print('Model: ${info.model}');
print('RAM: ${info.ram}');
print('CPU: ${info.cpu}');
print('OS Version: ${info.osVersion}');
3. Get Specific Information #
String? deviceId = await FlutterDeviceInspector.getDeviceId();
String? model = await FlutterDeviceInspector.getDeviceModel();
String? ram = await FlutterDeviceInspector.getTotalRam();
📱 Platform Support & Implementation Details #
This plugin uses Platform Channels to communicate between Dart and the native operating system.
| Feature | Android Implementation | iOS Implementation | Web Support |
|---|---|---|---|
| Device ID | Settings.Secure.ANDROID_ID |
identifierForVendor |
localStorage UUID |
| Model | android.os.Build.MODEL |
UIDevice.current.model |
Browser Name |
| RAM | ActivityManager.MemoryInfo (GB) |
ProcessInfo.physicalMemory (GB) |
deviceMemory (GB) |
| Storage | StatFs (MB) |
systemSize (MB) |
❌ (Not Accessible) |
| CPU | /proc/cpuinfo (Hardware/Model) |
sysctlbyname (brand string) |
hardwareConcurrency |
| OS Version | Build.VERSION.RELEASE |
UIDevice.current.systemVersion |
navigator.platform |
How it works: #
- Dart Side: When you call
getDeviceId(), Flutter sends a message over aMethodChannelnamedflutter_device_inspector. - Native Side:
- On Android, the Kotlin code receives this message and queries the Android System APIs.
- On iOS, the Swift code receives the message and queries the iOS
UIDeviceorProcessInfoAPIs.
- Response: The native value is sent back across the channel to your Dart code as a
Future.
Note on Web Support: This plugin now fully supports the Web platform! It generates a Constant Unique ID using browser fingerprinting (SHA-256 hash of hardware and browser properties). This ID remains the same even if the user clears their cache or uninstalls/reinstalls the browser, as it is tied to the device's hardware configuration (CPU, RAM, Screen, etc.).
📄 License #
This project is licensed under the MIT License - see the LICENSE file for details.