Flutter drag and drop inside UI in desktop application - flutter

Talking about a desktop application now, not mobile or web.
Is it any widget in Flutter that will allow, for example, drag a folder, drop it in the application UI, and the app will read for example the path to that file or folder?
I have been reading about Draggable and DragTarget in Flutter, but i do think they are used for that purpose.
NOTE: it might not exist a widget for that purpose, so a strategy on how to do that in Flutter will also be appreciated.

Assuming you're talking about dragging from outside the application, it's not currently supported; Flutter #30719 would be the issue to watch/upvote.
Depending on the specific platform you might be able to implement it with a plugin in the short term (if you are familiar with native development on that platform), but that would likely be more work than contributing an implementation to Flutter itself.

Flutter has a dependency to support such behavior now. Check this link
https://pub.dev/packages/desktop_drop

Related

Do iOS and Android Flutter widgets also work on Flutter Web(PWA)

I'm interested in using Flutter primarily for my startup MVP on Web and possibly Android. I see the flutter community has made a lot of widgets but a lot of them are tagged iOS or Android. Since Futter is all about using one codebase is it wrong to assume that these widgets would work on web too? I imagine the setup would be different but similar with a Flutter web app as opposed to a Flutter Android app.
I couldn't find a whole lot about this on the Flutter site. I also know that web is still beta but by the time I'm done with the MVP it'll probably be at stable release or close enough.
Well... It depends. If the widget has some sort of native code the answer is no. In Flutter there are two type of packages: the "normal" package, and the plugin.
The packages are made only of dart code, so there are no bounds to native, and you can use everywhere dart (and Flutter) can run.
The plugins are packages with native code and you can use only on the platform supported by that plugin.
For example the package provider, it's a package, and you can use in every supported platform where dart (and Flutter) can run. But url_launcher, it's a plugin, so you can run only on Android, iOS, and web, but for example on desktop, it will no work.
If the package if you found it's only a widget, you should be able to use on the web.
TLDR: No,a PWA it's a web app, so it can't run Android or iOS specific code.

is it possible to embed an ionic application within a flutter application?

To be more precise, I already have a huge app writen in Ionic and now we're considering to migrate it to flutter, but we can't rewrite it from scratch, both ionic and flutter should coexist.
So my question is: can I have a flutter app as a "host" and import / run the ionic app inside it? Something like a micro frontend.
Until now I was able to build the target ionic app and import it on the flutter app, under android folder, but it does not feels like a productive way to approach the problem.
I also googled a little bit about this integration, but did not find anything that solves this problem.
I appreciate any help on this topic.
Yes, it is possible, but very cumbersome.
I did it for a project and embedded 3 ionic apps inside flutter.
I'll not list every problem that i faced but just go through some points to give you an idea.
You will need to take care of some cordova plugins that use native code, for Android copy and paste some folders like CordovaLib,cordova and use it as a library. For iOS you must add the plugin files like *.h to the compiles list inside Xcode and create an Pod to get the cordova resources (that's the way i did)
To "launch" the app for android you need to start the cordova activity and for iOS you need to play with UINavigationController and FlutterViewController, and of course create a method channel to be possible to call it from Flutter.
For multiple apps, you have to mess inside de cordova code to get the app from the right www folder and be sure to equalize every plugin version between apps.
Some packages from flutter may clash with ionic/cordova libs
Every change you do to your ionic application it must be tested outside flutter and within it to see if there's any mismatch behavior that you didn't expect, specially when adding new plugins.
Maybe some permission issues will arrive between applications like camera or localization.
I know thats not the answer, but when searching on how to do it, i stumbled upon this question a few months ago and it still without any answer on this problem.
But my final take is that the effort of joining together all pieces using multiple languages and frameworks together with the job of maintaining this spaghetti behemoth is not worth it and you'll save yourself of a tremendous headache.

Flutter add-to-app, Can we add multiple Flutter module into native project?

I have a question with Flutter's add-to-app current limitation here.
Refer to this doc. https://flutter.dev/docs/development/add-to-app
As of Flutter v1.12, add-to-app is supported for the basic scenario of integrating one full-screen Flutter instance at a time per app. It currently has the following limitations:
- Running multiple Flutter instances or running in partial screen views may have undefined behavior.
- Using Flutter in background mode is still a WIP.
- Packing multiple Flutter libraries into an application isn’t supported.
- Plugins used in add-to-app on Android should migrate to the [new Android plugin APIs][], based on FlutterPlugin.
Plugins that don’t support FlutterPlugin may have unexpected behaviors if they make assumptions that are untenable in add-to-app (such as assuming that a Flutter Activity is always present).
- As of v1.17, the Flutter module only supports AndroidX applications on
For this statement
Packing multiple Flutter libraries into an application isn’t supported.
Am I understand correctly that we can only create and add 1 Flutter module project into our android or ios project?
If yes then is there any workaround to do that?
You can separate your module by implement sub-module inside your main Flutter module, each sub-module will be controlled by a Flutter engine, meaning you'll have multiple Flutter engines, so state in each module will be kept and separated with the others.
You can refer my demo here https://github.com/duytq94/demo-integrate-flutter, partial screen & full screen is separated from each other.

How to make Modularization in Flutter to separate each application feature

On Android native to separate each application feature, structured the project, implementing architecture component and to make it easier to work in a team you can use modularization, so each person can focus on their respective work by focusing only on the module. If I want to make a flutter application with examples of 3 application features (login, register, profile) and want to implement modularization for each feature to make it easier to work as a team. How do you implement the modular? Are there references to its best practices for modularizing Flutter? Because if on Android Native there are already many related articles while I check for Flutter it hasn't found it yet.
Create each feature as a package(library) and add it whenever you want to the main app. For example in my app I use main.dart as a navigator manager and each screen is in different packages.
And this is an example of implementing it: https://github.com/rrifafauzikomara/flutter_modularization

Flutter - Am I able to creat a module with Flutter and use it in my iOS and Android projects?

In my company, we are working on a huge product. We have a repo for the Android project and also we have another repo for the iOS project.
I think it is impossible to rewrite the whole of the project in Flutter. So, something that popped in my mind but I am not sure if it is feasible. Each Android/iOS project contains many modules. I am working on a module called Enterprise. It has its own Activities, Fragments and business logic. So, my question is, Am I able to consider this module as a black box (it has a few inputs that are coming from the other modules and a few outputs that will be presented in the app module) and make it by Flutter. Then I will use its .aar version in the Android project as well as the iOS project.
Does an implementation like this is feasible?
Okay, I found Flutter is thinking of a way to solve this issue. I found two links that might be useful to you, too:
Add Flutter to existing apps. According to this page, "The "add-to-app" support is in preview, and is so far only available on the master channel.".
Integrating Flutter into an Existing App.
I will be more than happy to accept your answer if you have a better approach.