setCallback method

void setCallback(
  1. dynamic callback(
    1. ReciveData
    ),
  2. dynamic tareCallback(
    1. 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);
    }
  });
}