zebra_rfid_sdk_plugin

Creator: coderz1093

Last updated:

Add to Cart

Description:

zebra rfid sdk plugin

Zebra Rfid SDK Plugin #
Steps to follow #

flutter pub add zebra_rfid_sdk_plugin
create/add folder to android



create android/RFIDAPI3Library folder


download content from below link and copy in android/RFIDAPI3Library
Note:- (build.gradle and RFIDAPI3Library.arr add this files to android/RFIDAPI3Library) Link



In setting.gradle add below lines.


include ':app',':RFIDAPI3Library' //RFIDAPI3Library is folder name


In build.gradle add below lines. // app level (android/app/build.gradle)



dependencies {
implementation project(":RFIDAPI3Library",)
}
//RFIDAPI3Library is folder name
see here -> link



Add below line to Android.xml


xmlns:tools="http://schemas.android.com/tools" (this will under manifest tag)
tools:replace="android:label" (this will add under application tag)


minSdkVersion 19 or higher



Ready to use :D


still confuse refer this link example app


Examples #
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:zebra_rfid_sdk_plugin/zebra_event_handler.dart';
import 'package:zebra_rfid_sdk_plugin/zebra_rfid_sdk_plugin.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatefulWidget {
const MyApp({super.key});

@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
String? _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
initPlatformState();
}

Map<String?, RfidData> rfidDatas = {};
ReaderConnectionStatus connectionStatus = ReaderConnectionStatus.UnConnection;
addDatas(List<RfidData> datas) async {
for (var item in datas) {
var data = rfidDatas[item.tagID];
if (data != null) {
if (data.count == null) data.count = 0;
data.count = data.count + 1;
data.peakRSSI = item.peakRSSI;
data.relativeDistance = item.relativeDistance;
} else
rfidDatas.addAll({item.tagID: item});
}
setState(() {});
}

// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String? platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformVersion = await ZebraRfidSdkPlugin.platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
if (!mounted) return;

setState(() {
_platformVersion = platformVersion;
});
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Status ${connectionStatus.index}'),
),
body: Center(
child: Column(
children: [
Text('Running on: $_platformVersion\n'),
Text('count:${rfidDatas.length.toString()}'),
const SizedBox(height: 20),
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
ElevatedButton(
onPressed: () async {
ZebraRfidSdkPlugin.setEventHandler(ZebraEngineEventHandler(
readRfidCallback: (datas) async {
addDatas(datas);
},
errorCallback: (err) {
ZebraRfidSdkPlugin.toast(err.errorMessage);
},
connectionStatusCallback: (status) {
setState(() {
connectionStatus = status;
});
},
));
ZebraRfidSdkPlugin.connect();
},
child: const Text("read"),
),
ElevatedButton(
onPressed: () async {
setState(() {
rfidDatas = {};
});
},
child: const Text("clear"),
),
ElevatedButton(
onPressed: () async {
ZebraRfidSdkPlugin.disconnect();
},
child: const Text("stop"),
),
]),
Expanded(
child: Scrollbar(
child: ListView.builder(
itemBuilder: (context, index) {
var key = rfidDatas.keys.toList()[index];
return ListTile(title: Text(rfidDatas[key]?.tagID ?? 'null'));
},
itemCount: rfidDatas.length,
),
))
],
)),
));
}
}
}
copied to clipboard
Tested on Zebra MC33 Device #

Authors #

@Justin Roy

Badges #



Support #
For support, give a star ⭐ to repo.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.