device_serial_number

Flutter plugin that reads the device hardware serial number on Android, including SUNMI POS terminals.

On most devices this uses Build.getSerial(). When that returns unknown (common on SUNMI hardware), the plugin falls back to OEM system properties such as ro.sunmi.serial and ro.serialno.

Installation

Add to your pubspec.yaml:

dependencies:
  device_serial_number: ^0.0.1

Usage

import 'package:device_serial_number/device_serial_number.dart';

final serial = await DeviceSerialNumber.getSerialNumber();

Returns null when the serial is unavailable or the platform is unsupported.

Android permissions

On Android 8+ (API 26), READ_PHONE_STATE must be granted at runtime before Build.getSerial() succeeds. Add the permission to your app manifest and request it from your host app before calling this plugin.

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Platform support

Platform Supported
Android Yes
iOS No

Example

See the example/ app for a minimal integration.