-
Notifications
You must be signed in to change notification settings - Fork 18
remove the use of waitFor
#42
Comments
Any proposed way how should we do it? I think we either need to find a way to synchronously resolve pakage uri (as seen in https://github.com/dart-lang/tflite_native/blob/master/lib/src/bindings/dlib.dart#L50 ) , or turn every API of this package into async |
I would keep all the API sync, except for a new init method. Users of the API would then need to call init(), await the response, and then use the resulting api object as normal. This would likely change the API structure a bit. Instead of everything being a top level method, clients would instead invoke method on something like an MLBindings object. At a very rough sketch, something like this: Future<MLBindings> init() {
...
}
class MLBindings {
final DynamicLibrary _dynamicLibrary;
MLBindings._(this._dynamicLibrary);
String get version {
Pointer<Utf8> Function() TfLiteVersion = _dynamicLibrary
.lookup<NativeFunction<_TfLiteVersion_native_t>>('TfLiteVersion')
.asFunction();
return Utf8.fromUtf8(TfLiteVersion());
}
} That's a fairly darty version of the API. There are likely some refactorings that would mean a lot fewer changes to the current API - the API would be closer to the existing native tensorflow lite API, but be less idiomatic dart. |
Is there any progress on the proposal for this one? |
We should look into removing the use of
dart:cli
'swaitFor()
method.The text was updated successfully, but these errors were encountered: