printTable static method

Future<void> printTable({
  1. required List<ColumnMaker> cols,
})

Implementation

static Future<void> printTable({required List<ColumnMaker>cols})async{
  try{
    if(SunmiPrinter.isConnected){
       final List<Map<String, String>> _jsonCols = List<Map<String, String>>.from(
      cols.map<Map<String, String>>((ColumnMaker col) => col.toJson()));
   await _channel.invokeMethod('printTable',{"cols":json.encode(_jsonCols)});
    }else{
      throw("Printer is not connect");
    }
  }catch(err){
    rethrow;
  }

}