flutter_imin_device 0.0.3
flutter_imin_device: ^0.0.3 copied to clipboard
A Flutter plugin for retrieving device information from iMin POS devices.
Flutter iMin Device #
A Flutter plugin for retrieving device information from iMin POS devices.
This plugin provides a simple API to access basic device information such as:
- Serial Number
- Device Brand
- Device Model
Features #
- Get device serial number
- Get device brand
- Get device model
- Simple asynchronous API
- Uses Flutter
MethodChannelfor native platform communication - Designed for iMin POS devices
Installation #
Add flutter_imin_device to your pubspec.yaml:
dependencies:
flutter_imin_device: ^1.0.0
Then run:
flutter pub get
Replace
1.0.0with the latest available version.
Usage #
Import the package:
import 'package:flutter_imin_device/flutter_imin_device.dart';
Get Serial Number #
final serialNumber = await FlutterIminDevice.serialNumber;
print('Serial Number: $serialNumber');
Get Device Brand #
final brand = await FlutterIminDevice.deviceBrand;
print('Device Brand: $brand');
Get Device Model #
final model = await FlutterIminDevice.deviceModel;
print('Device Model: $model');
Get All Device Information #
You can retrieve all available information as follows:
final serialNumber = await FlutterIminDevice.serialNumber;
final brand = await FlutterIminDevice.deviceBrand;
final model = await FlutterIminDevice.deviceModel;
print('Serial Number: $serialNumber');
print('Brand: $brand');
print('Model: $model');
API Reference #
FlutterIminDevice.serialNumber #
Returns the serial number of the iMin device.
static Future<String?> get serialNumber
Returns:
String— Device serial numbernull— If the serial number cannot be retrieved
Example:
final serialNumber = await FlutterIminDevice.serialNumber;
FlutterIminDevice.deviceBrand #
Returns the brand of the device.
static Future<String?> get deviceBrand
Returns:
String— Device brandnull— If the brand cannot be retrieved
Example:
final brand = await FlutterIminDevice.deviceBrand;
FlutterIminDevice.deviceModel #
Returns the model of the device.
static Future<String?> get deviceModel
Returns:
String— Device modelnull— If the model cannot be retrieved
Example:
final model = await FlutterIminDevice.deviceModel;
Example #
A simple example:
import 'package:flutter/material.dart';
import 'package:flutter_imin_device/flutter_imin_device.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter iMin Device',
home: const DeviceInfoPage(),
);
}
}
class DeviceInfoPage extends StatefulWidget {
const DeviceInfoPage({super.key});
@override
State<DeviceInfoPage> createState() => _DeviceInfoPageState();
}
class _DeviceInfoPageState extends State<DeviceInfoPage> {
String? serialNumber;
String? brand;
String? model;
@override
void initState() {
super.initState();
_loadDeviceInfo();
}
Future<void> _loadDeviceInfo() async {
final results = await Future.wait([
FlutterIminDevice.serialNumber,
FlutterIminDevice.deviceBrand,
FlutterIminDevice.deviceModel,
]);
if (!mounted) return;
setState(() {
serialNumber = results[0];
brand = results[1];
model = results[2];
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('iMin Device Info'),
),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Serial Number: ${serialNumber ?? '-'}'),
Text('Brand: ${brand ?? '-'}'),
Text('Model: ${model ?? '-'}'),
],
),
),
);
}
}
Platform Support #
This plugin is intended for use with iMin POS devices.
| Platform | Support |
|---|---|
| Android | ✅ Supported |
| iOS | ❌ Not applicable |
| Web | ❌ Not applicable |
| Windows | ❌ Not applicable |
| macOS | ❌ Not applicable |
| Linux | ❌ Not applicable |
The actual platform support depends on the native implementation and iMin device APIs available on the target device.
Error Handling #
The plugin catches PlatformException when communication with the native platform fails.
If an error occurs, the API returns null.
For example:
final serialNumber = await FlutterIminDevice.serialNumber;
if (serialNumber == null) {
print('Unable to retrieve serial number');
return;
}
print('Serial Number: $serialNumber');
Requirements #
- Flutter
- Dart
- Android
- Compatible iMin POS device
Make sure the target iMin device provides access to the required native device information APIs.
Architecture #
The plugin communicates between Dart and the native Android implementation using Flutter's MethodChannel.
Flutter Application
│
▼
FlutterIminDevice
│
│ MethodChannel
▼
Native Android
│
▼
iMin Device API
│
▼
Device Information
The channel used by the plugin is:
flutter_imin_device
Available methods:
getSerialNumber
getDeviceBrand
getDeviceModel
Contributing #
Contributions, issues, and feature requests are welcome.
If you encounter a problem with a specific iMin device model, please include:
- iMin device model
- Android version
- Flutter version
- Plugin version
- Error message or logs
License #
This project is licensed under the MIT License.
See the LICENSE file for details.
Disclaimer #
This is an independent Flutter plugin for integrating Flutter applications with iMin POS devices.
It is not affiliated with, endorsed by, or officially maintained by iMin Technology or iMin Singapore.