Dart UI isolate fix (#1828)
## Description - Fix for using dart_ui_isolate package properly ## Test Neeraj tested it
This commit is contained in:
commit
6ee38cb291
1 changed files with 8 additions and 1 deletions
|
@ -109,6 +109,7 @@ class FaceMlService {
|
|||
return;
|
||||
}
|
||||
_logger.info("init called");
|
||||
_logStatus();
|
||||
await _computer.compute(initOrtEnv);
|
||||
try {
|
||||
await FaceDetectionService.instance.init();
|
||||
|
@ -245,6 +246,7 @@ class FaceMlService {
|
|||
}
|
||||
|
||||
/// The main execution function of the isolate.
|
||||
@pragma('vm:entry-point')
|
||||
static void _isolateMain(SendPort mainSendPort) async {
|
||||
final receivePort = ReceivePort();
|
||||
mainSendPort.send(receivePort.sendPort);
|
||||
|
@ -517,7 +519,8 @@ class FaceMlService {
|
|||
for (final smallestChunk in smallerChunks) {
|
||||
if (!await canUseHighBandwidth()) {
|
||||
_logger.info(
|
||||
'stopping indexing because user is not connected to wifi',);
|
||||
'stopping indexing because user is not connected to wifi',
|
||||
);
|
||||
break outerLoop;
|
||||
}
|
||||
for (final enteFile in smallestChunk) {
|
||||
|
@ -761,6 +764,9 @@ class FaceMlService {
|
|||
// disposeImageIsolateAfterUse: false,
|
||||
);
|
||||
if (result == null) {
|
||||
_logger.severe(
|
||||
"Failed to analyze image with uploadedFileID: ${enteFile.uploadedFileID}",
|
||||
);
|
||||
return false;
|
||||
}
|
||||
final List<Face> faces = [];
|
||||
|
@ -880,6 +886,7 @@ class FaceMlService {
|
|||
),
|
||||
) as String?;
|
||||
if (resultJsonString == null) {
|
||||
_logger.severe('Analyzing image in isolate is giving back null');
|
||||
return null;
|
||||
}
|
||||
result = FaceMlResult.fromJsonString(resultJsonString);
|
||||
|
|
Loading…
Reference in a new issue