send method

  1. @override
Future<bool> send(
  1. List<int> bytes
)
override

Implementation

@override
Future<bool> send(List<int> bytes) async {
  try {
    if (Platform.isAndroid) {
      // final connected = await _connect();
      // if (!connected) return false;
      Map<String, dynamic> params = {"bytes": bytes};
      return await flutterPrinterChannel.invokeMethod('sendDataByte', params);
    } else if (Platform.isIOS) {
      Map<String, Object> args = Map();
      args['bytes'] = bytes;
      args['length'] = bytes.length;
      iosChannel.invokeMethod('writeData', args);
      return Future.value(true);
    } else {
      return false;
    }
  } catch (e) {
    return false;
  }
}