createAsync static method

Future<WeChatQRCode> createAsync([
  1. String detectorPrototxtPath = "",
  2. String detectorCaffeModelPath = "",
  3. String superResolutionPrototxtPath = "",
  4. String superResolutionCaffeModelPath = "",
])

Implementation

static Future<WeChatQRCode> createAsync([
  String detectorPrototxtPath = "",
  String detectorCaffeModelPath = "",
  String superResolutionPrototxtPath = "",
  String superResolutionCaffeModelPath = "",
]) async {
  final arena = Arena();
  final dp = detectorPrototxtPath.toNativeUtf8(allocator: arena).cast<ffi.Char>();
  final dm = detectorCaffeModelPath.toNativeUtf8(allocator: arena).cast<ffi.Char>();
  final srp = superResolutionPrototxtPath.toNativeUtf8(allocator: arena).cast<ffi.Char>();
  final srm = superResolutionCaffeModelPath.toNativeUtf8(allocator: arena).cast<ffi.Char>();
  final rval = cvRunAsync<WeChatQRCode>(
    (callback) => cffi.WeChatQRCode_NewWithParams_Async(dp, dm, srp, srm, callback),
    (c, p) => c.complete(WeChatQRCode.fromPointer(p.cast<cvg.WeChatQRCode>())),
  );
  arena.releaseAll();
  return rval;
}