setCallback method
void
setCallback(
- dynamic callback(
- ReciveData
),
- dynamic tareCallback(
- String
)
)
override
Implementation
void setCallback(
Function(ReciveData) callback, Function(String) tareCallback) {
methodChannel.setMethodCallHandler((call) async {
if (call.method == 'onDataReceived') {
Map<String, dynamic> arguments =
Map<String, dynamic>.from(json.decode(call.arguments as String));
ReciveData reciveData = ReciveData.fromJson(arguments);
print("reciveData" + reciveData.m_fWeight.toString());
callback(reciveData);
} else if (call.method == 'onReadTare') {
tareCallback(call.arguments as String);
}
});
}