|
@@ -2,7 +2,6 @@ import "dart:async";
|
|
import "dart:io";
|
|
import "dart:io";
|
|
|
|
|
|
import "package:connectivity_plus/connectivity_plus.dart";
|
|
import "package:connectivity_plus/connectivity_plus.dart";
|
|
-import "package:flutter/services.dart";
|
|
|
|
import "package:logging/logging.dart";
|
|
import "package:logging/logging.dart";
|
|
import "package:path/path.dart";
|
|
import "package:path/path.dart";
|
|
import "package:path_provider/path_provider.dart";
|
|
import "package:path_provider/path_provider.dart";
|
|
@@ -134,13 +133,13 @@ abstract class MLFramework {
|
|
}
|
|
}
|
|
|
|
|
|
Future<String> _getLocalImageModelPath() async {
|
|
Future<String> _getLocalImageModelPath() async {
|
|
- return (await getTemporaryDirectory()).path +
|
|
|
|
|
|
+ return (await getApplicationSupportDirectory()).path +
|
|
"/models/" +
|
|
"/models/" +
|
|
basename(getImageModelRemotePath());
|
|
basename(getImageModelRemotePath());
|
|
}
|
|
}
|
|
|
|
|
|
Future<String> _getLocalTextModelPath() async {
|
|
Future<String> _getLocalTextModelPath() async {
|
|
- return (await getTemporaryDirectory()).path +
|
|
|
|
|
|
+ return (await getApplicationSupportDirectory()).path +
|
|
"/models/" +
|
|
"/models/" +
|
|
basename(getTextModelRemotePath());
|
|
basename(getTextModelRemotePath());
|
|
}
|
|
}
|
|
@@ -176,17 +175,6 @@ abstract class MLFramework {
|
|
return connectivityResult != ConnectivityResult.mobile ||
|
|
return connectivityResult != ConnectivityResult.mobile ||
|
|
shouldDownloadOverMobileData;
|
|
shouldDownloadOverMobileData;
|
|
}
|
|
}
|
|
-
|
|
|
|
- Future<String> getAccessiblePathForAsset(
|
|
|
|
- String assetPath,
|
|
|
|
- String tempName,
|
|
|
|
- ) async {
|
|
|
|
- final byteData = await rootBundle.load(assetPath);
|
|
|
|
- final tempDir = await getTemporaryDirectory();
|
|
|
|
- final file = await File('${tempDir.path}/$tempName')
|
|
|
|
- .writeAsBytes(byteData.buffer.asUint8List());
|
|
|
|
- return file.path;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class MLFrameworkInitializationUpdateEvent extends Event {
|
|
class MLFrameworkInitializationUpdateEvent extends Event {
|