flutter_device_specs
A comprehensive, performance-focused Flutter plugin for retrieving detailed, low-level hardware and system specifications. Specially optimized for Android, this plugin provides deep hardware introspection including commercial advertised RAM, real system RAM, CPU architecture and features, battery health, available hardware sensors, network telemetry, and security parameters.
π Features
This plugin provides deep diagnostics across seven key categories:
| Category | Retrieved Parameters |
|---|---|
| π± Identity & OS | Brand, model, manufacturer, system version (Android level & build number), kernel version, and secure unique Android ID. |
| π₯οΈ Display | Resolution, diagonal size (in inches), refresh rate, pixel density, orientation, and HDR support capabilities. |
| βοΈ Processor (CPU) | Name/Hardware model, architecture (e.g., arm64, x86_64), logical core count, max hardware frequency, and system instruction features (e.g., NEON, AES). |
| π§ Memory & Storage | Commercial (advertised) RAM, real system RAM, available memory, real-time memory usage (%), and total/free internal storage space. |
| π Battery | Status (charging/discharging), level (%), health (good, overheat, dead, etc.), temperature, voltage, and hardware capacity (mAh). |
| π Network | Connection type (Wi-Fi, cellular, ethernet), internet validation status, link speed estimation, local IP, and MAC address. |
| π Security | Screen lock configuration, biometrics support (fingerprint, face unlock), and storage encryption status. |
| π Sensors | Hardware availability checking for: Accelerometer, Gyroscope, Magnetometer, Proximity, Ambient Light, Barometer, Temperature, Humidity, Step Counter, Heart Rate, and Gravity. |
π§ Understanding Android RAM ("Commercial" vs "Real")
On Android devices, the memory reported by the OS (ActivityManager.MemoryInfo.totalMem) is always lower than the RAM size listed on the product box (e.g., a phone advertised as having "8 GB of RAM" will report roughly 7.1 GB of usable system RAM because a portion is permanently allocated to the GPU, baseband radio, and low-level firmware).
To prevent user confusion, flutter_device_specs implements the following behavior:
- Android 14+ (API 34+): Uses the official
advertisedMemAPI, which returns the rounded, consumer-facing value (e.g., exactly8.0 GB). - Android < 14: Gracefully falls back to the actual system-addressable memory (
totalMem). - Both values (
totalPhysicalMemoryandrealPhysicalMemory) are returned side-by-side insideMemoryInfoso you can choose which one to display.
π¦ Installation
Add flutter_device_specs to your pubspec.yaml dependencies:
flutter pub add flutter_device_specs
Import it in your Dart code:
import 'package:flutter_device_specs/flutter_device_specs.dart';
π» Usage
1. Initialize the Plugin
Create an instance of FlutterDeviceSpecs:
final deviceSpecsPlugin = FlutterDeviceSpecs();
2. Fetch Full Device Information
Retrieve identity, display, CPU, memory, and security details in a single call:
try {
DeviceInfo info = await deviceSpecsPlugin.getDeviceInfo();
print('Device Model: ${info.model}');
print('Manufacturer: ${info.manufacturer}');
print('Android OS Version: ${info.systemVersion}');
print('Advertised RAM: ${info.memoryInfo.totalPhysicalMemoryGB} GB');
print('Real RAM: ${info.memoryInfo.realPhysicalMemory} bytes');
print('CPU Name: ${info.processorInfo.processorName}');
} on PlatformException catch (e) {
print('Failed to get device specs: ${e.message}');
}
3. Fetch Memory Info Separately (Great for Live Monitoring)
If you are building a monitoring dashboard and want to periodically refresh memory and storage stats without the overhead of fetching all device specs again, use getMemoryInfo():
Timer.periodic(const Duration(seconds: 2), (timer) async {
MemoryInfo mem = await deviceSpecsPlugin.getMemoryInfo();
print('Available Memory: ${mem.availablePhysicalMemory} bytes');
print('Memory Usage: ${mem.memoryUsagePercentage}%');
});
4. Fetch Battery & Network Status
// Fetch battery details
BatteryInfo? battery = await deviceSpecsPlugin.getBatteryInfo();
if (battery != null) {
print('Battery Level: ${battery.batteryLevel}%');
print('Battery Health: ${battery.batteryHealth}');
}
// Fetch network status
NetworkInfo network = await deviceSpecsPlugin.getNetworkInfo();
print('Connection Type: ${network.connectionType}');
print('Is connected to internet: ${network.isConnected}');
5. Check Available Sensors (Enhanced Enum)
SensorType is implemented as an Enhanced Enum providing rich metadata for each sensor:
sensor.value: Raw native key identifier (e.g.'accelerometer').sensor.label: Clean human-readable French label (e.g.'Accéléromètre').sensor.description: Detailed French explanation of the sensor's role and purpose.
SensorInfo sensors = await deviceSpecsPlugin.getSensorInfo();
// Check specific sensors
bool hasGyro = sensors.has(SensorType.gyroscope);
bool hasFingerprint = sensors.has(SensorType.fingerprint);
print('Has Gyroscope: $hasGyro');
print('Has Fingerprint Reader: $hasFingerprint');
// Iterate through all detected sensors with their French label & description
for (final sensor in sensors.availableSensors) {
print('${sensor.label} (${sensor.value}): ${sensor.description}');
}
π οΈ Platform Support & Integration
Android
- Minimum SDK: API Level 24 (Android 7.0)
- Compile SDK: API Level 34+ (Android 14)
- No additional permissions are required for basic features. However, retrieving advanced Wi-Fi speeds or MAC addresses may require location or network state permissions depending on the target Android OS version.
iOS
- Min iOS Version: 13.0
- β οΈ Note: This plugin is tailored for deep Android diagnostics. On iOS, calling the specific info methods (
getDeviceInfo,getMemoryInfo,getBatteryInfo,getSensorInfo,getNetworkInfo) will return a cleanPlatformExceptionwith anUNIMPLEMENTEDcode instead of silently crashing, allowing you to handle the platform check gracefully.
ποΈ Architecture
This plugin follows the Federated Plugin Architecture:
lib/flutter_device_specs.dart: The public entry point for applications.lib/flutter_device_specs_platform_interface.dart: The abstract interface class enforcing implementation rules.lib/flutter_device_specs_method_channel.dart: The default channel-based implementation communicating with native layers.
π License
This project is licensed under the MIT License - see the LICENSE file for details.