loadImgdbFromAssets method

Future<void> loadImgdbFromAssets(
  1. {@required String tempFilePath,
  2. String imgdbAssetPath = 'assets/image_database.imgdb'}
)

example of tempFilePath : /data/user/0/

Implementation

Future<void> loadImgdbFromAssets(
    {@required String tempFilePath,
    String imgdbAssetPath = 'assets/image_database.imgdb'}) async {
  final File tempFile = File(tempFilePath);

  // create tempfile
  await tempFile.create();

  final ByteData loadedImgdbByteData = await rootBundle.load(imgdbAssetPath);

  try {
    tempFile.writeAsBytesSync(loadedImgdbByteData.buffer.asUint8List(
        loadedImgdbByteData.offsetInBytes,
        loadedImgdbByteData.lengthInBytes));
  } on Exception catch (e) {
    throw ArCorePluginAssetLoadingException(e.toString());
  }
  return;
}