I have a tensorflow lite ML model that I'd like to use in a flutter application.
One of my first options was to test plugins available on pub dev. Unfortunately, I was unable to find one that is still working in 2023.
Both of the major two plugins appear to have been abandoned. tflite_flutter and tflite
- Is there an official flutter package available for this use case?
- Or are there any other options for integrating Tensorflow models into a Flutter app?
Related
I am a beginner at flutter and i have project which contains a deep learning model so I used tflite package to integrate the dl model's tflite version with flutter app. But when I install tflite plugin it shows an error like this.
The plugin `tflite` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this
plugin supports the Android V2 embedding.
Otherwise, consider removing it since a future release of Flutter will remove these
deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2
embedding:
After that, I also searched about this problem and followed the flutter official link's instructions but still, it's not working so, If you had any solution about that then tell about that.
So, I'm thinking of creating a CLI application that could also be used with UI, developed in Flutter.
The idea is that there would be 3 different packages, one for the business logic, one for the CLI and one for the Flutter app. Is there a way to import the Flutter app as a dependency in my CLI package, so I could open the Flutter app from the CLI? If so, how would I do it?
Seems like you want to use 1 library containing the business logic for 2 different applications: Desktop CLI app and mobile app (android/iOS).
It's very much possible with flutter. By default flutter installs only the android and iOS platform supports but by changing few configurations in installed flutter SDK we can extend the same setup to Web and Desktop apps (Windows, MacOS or linux) as well.
Check this official doc for enabling desktop support
Check this official doc for enabling Web support
You can enable these settings in your existing application only.
Can you guys tell me what all these different projects means?
New Flutter Project
Because I can't find the documentation anywhere
So if you can find the reference it will help me
Flutter Application: A fully-functional standalone Flutter application.
Flutter Plugin: A plugin is a kind of bridge that you develop between a native feature like camera API in Android and iOS.
Flutter Package: A package is a flutter application written solely using Dart. It doesn't have much to do with the Native functionalities.
Flutter Module: A module is a set of functionalities that you want to use in your app. It is a custom code that does a specific task but can be used for other apps in the future. So, you keep it handy. In other words, this module can be integrated in other apps too.
I am new to flutter plugin development, I have read Developing packages & plugins and Writing a good Flutter plugin, but I am confused as a beginner, I have developed Flutter Application based on webview_flutter and a JavaScript library to work offline. I want to extend it as a module or a plugin.
Webview renders some stuff.
JavaScript library is being attached from assets.
I am not calling any Platform API directly from my code but my code depends on another plugin.
How do I proceed this? As a plugin or as a module?
A plugin is about making native functionality available to Flutter.
A module is about integrating Flutter with an existing native application.
Perhaps what you actually want is a reusable Pub package that you can publish to pub.dartlang.org (a plugin is also a Pub package, just a special one that additionally utilizes access to the native platform)
See also
https://flutter.io/docs/development/packages-and-plugins/developing-packages
https://www.dartlang.org/guides/libraries/create-library-packages
A "library package" is a Pub package in contrary to a plain Dart "application package" which is usually not published to pub.dartlang.org.
A pure Dart Pub package (library package) that does not depend on dart:html, dart:ui (Flutter) and is not a Flutter plugin, can be used on any platform (server, command line, Flutter, browser).
If your package has one of the named dependencies, it is limited to a specific platform.
pub.dartlang.org shows labels to categorize published packages accordingly (FLUTTER,WEB,OTHER)
Flutter plugins:
In short: Native related developments.
Flutter plugin is the wrapper of the native code like android( Kotlin or java) and iOS(swift or objective c). ... Flutter can do anything that a native application can through the use of Platform Channels and Message Passing. Flutter instructs the native iOS/Android code to perform an action and returns the result to Dart.
Flutter packages or modules:
In short: Make the development faster by using code from util libraries.
Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch.
I have a library our partners use to drop our UI and flow into their apps. Can I make a cocoapod or framework file or an aar file or gradle dependency with a flutter project?
Yes! For general information, see https://flutter.dev/docs/development/add-to-app
To create an AAR from a Flutter module that other Android apps can use without any direct dependency on Flutter, see Option A - Depend on the Android Archive (AAR)
To create a Framework from a Flutter module that other iOS apps can use without any direct dependency on Flutter, see Option B - Embed frameworks in Xcode
You can also find samples at
https://github.com/flutter/samples/tree/master/experimental/add_to_app, refer to the respective samples: android_using_prebuilt_module and ios_using_prebuilt_module
Now, if you are talking about integrating Flutter into an existing library (AAR or Framwork), then no, this is currently not supported, but is being explored:
https://github.com/flutter/flutter/issues/39027
note that this would be termed “add-to-library” as opposed to "add-to-app"
also mentioned, flutter/add-to-app:
Packing a Flutter library into another sharable library or packing multiple Flutter libraries into an application isn’t supported.