Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run a Python method from a Flutter app?

I created a face recognition method in Python that compares an image (from a parameter) to another one, from a local repository. I need it to be called from a Flutter front-end, is it somehow possible?

It can't be as an API request, since the application must also work offline.

like image 488
gustavosmanc Avatar asked Nov 07 '22 10:11

gustavosmanc


1 Answers

No, there's no provided way to call directly into Python code from Dart, and by extension Flutter.

If this is absolutely critical to your application, you could theoretically call into a Python method from Java/Kotlin on Android using the approach described here and then pass the result back to Dart code via a MethodChannel. However, you're probably better off finding a Flutter plugin or Dart package that can do the work you need to perform.

like image 98
Ben Konyi Avatar answered Nov 14 '22 21:11

Ben Konyi