bluetoothContactlessFileUpload method

  1. @override
Future<int> bluetoothContactlessFileUpload()
override

required Contactless file upload when new device connected

Implementation

@override
Future<int> bluetoothContactlessFileUpload() async {
  const bool prod = bool.fromEnvironment('dart.vm.product');
  String fileName =
      prod ? "clss_param_d135.clss" : "clss_param_d135_debug.clss";
  // String fileName = "clss_param_d135.clss";
  ByteData assetFile =
      await rootBundle.load('packages/dtb_link/assets/$fileName');
  final dir = await getApplicationDocumentsDirectory();
  String filePath = '${dir.path}/$fileName';
  debugPrint("filePath: $filePath");
  final file = File('${dir.path}/$fileName');
  await file.writeAsBytes(assetFile.buffer.asInt8List());
  return _fileDownload(fileName, filePath);
}