send method

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

Implementation

@override
Future<bool> send(List<int> bytes) async {
  if (Platform.isAndroid)
    try {
      // final connected = await _connect();
      // if (!connected) return false;
      Map<String, dynamic> params = {"bytes": bytes};
      return await flutterPrinterChannel.invokeMethod('printBytes', params);
    } catch (e) {
      return false;
    }
  else if (Platform.isWindows)
    try {
      Map<String, dynamic> params = {"bytes": Uint8List.fromList(bytes)};
      return await flutterPrinterChannel.invokeMethod('printBytes', params) == 1 ? true : false;
    } catch (e) {
      await this._close();
      return false;
    }
  else
    return false;
}