A Flutter plugin to integrate Urovo device hardware features including Beeper, Printer, Scanner, and Magnetic Card Reader (SearchMagCard). This library enables easy access to Urovo-specific services for printing receipts, scanning barcodes, reading magnetic cards, and playing beep sounds directly from your Flutter app.
- π Beeper Service: Play beep sounds for user feedback.
- π¨οΈ Print Service: Print text, images, barcodes, and QR codes with customizable formatting.
- π· Scanner Service: Scan barcodes using device cameras with configurable options.
- π³ SearchMagCard Service: Listen to magnetic card swipe events and handle card data.
- β‘ Supports asynchronous event listeners with error handling.
- π§© Easy integration with Flutter apps and minimal setup.
Add this to your pubspec.yaml
:
dependencies:
urovo_flutter:
git:
url: https://github.com/GradleBuildTech/urovo_flutter.git
flutter pub get
import 'package:urovo_flutter/urovo.dart';
import 'package:flutter/services.dart' show rootBundle;
late UrovoService _urovoService;
@override
void initState() {
super.initState();
_urovoService = UrovoService(device: UrovoDevice.urovo);
}
π³ Magnetic Card Reader (SearchMagCard) Listen to magnetic card swipe events:
_urovoService.startListening(
onMagCardEvent: (magCardEvent) {
print('Magnetic Card Event: ${magCardEvent.toJson()}');
},
onError: (error) {
print('Error: $error');
},
);
π· Scanner Service Start scanning barcodes with the camera:
_urovoService.scannerService.startScan(
onScanResult: (result) {
print(result);
},
scannerObject: ScannerObject(timeOut: 100, cameraView: CameraView.back),
);
π¨οΈ Printer Service Print text, images, and QR codes:
final imageData = await rootBundle.load("assets/ic_app_dark.png");
_urovoService.onPrint(
printModel: PrintModel(
spacing: 0,
items: [
PrintItemModel(isSpacing: true, size: 14, bold: true),
PrintItemModel(
textLeft: "SAMPLE RECEIPT",
size: 2,
bold: true,
align: PrintItemAlign.center,
),
PrintItemModel(
image: PrintImage(imageData: imageData, width: 40, height: 20),
align: PrintItemAlign.center,
),
PrintItemModel(
qrCode: "1234567890",
align: PrintItemAlign.center,
),
],
),
);
π Beeper Service Play a beep sound:
_urovoService.onBeeper();
FloatingActionButton(
onPressed: () async {
_urovoService.startListening(
onMagCardEvent: (event) => print('MagCard: ${event.toJson()}'),
onError: (error) => print('Error: $error'),
);
final imageData = await rootBundle.load("assets/ic_app_dark.png");
_urovoService.onPrint(
printModel: PrintModel(
spacing: 0,
items: [
PrintItemModel(textLeft: "Demo Print", size: 2, bold: true),
PrintItemModel(image: PrintImage(imageData: imageData, width: 40, height: 20)),
PrintItemModel(qrCode: "1234567890", align: PrintItemAlign.center),
],
),
);
_urovoService.beep();
},
tooltip: 'Start Urovo Services',
child: const Icon(Icons.play_arrow),
);
- Real-time barcode scanning
- Printing text and images
- Playing alert beep sounds
- Reading data from magnetic cards
- Easy integration with Flutter
- Support for Urovo devices running Android
- This library only supports the Android platform.
- Please ensure your device is a Urovo device with the necessary hardware support.
- Make sure to check and grant the required permissions for the app to access hardware functions.