How to make Modularization in Flutter to separate each application feature - flutter

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

Related

Is it possible to run flutter module on Web

I have existing flutter module being used in native Android/iOS apps.Flutter module is used as I wanted to embed it in existing native Android/iOS app. After searching on internet I came to know that module cannot be used as it is to support web platform.
I am thinking about below approach
Creating new flutter app and copy existing module code (Not a good solution as per me because I will have to maintain 2 repos one for module(to support native platforms) and one for web app support).
Queries:
Has anyone came across such issue and what are the possible ways to
handle this scenario?
Can I embed this flutter app(not flutter module) in native apps?Will this create any
problem?
Please suggest possible solutions?

Is it possible to use Flutter components in another web application?

I was wondering if it's possible to run Flutter application components (such as building a specific screen) with other web apps. And if there is a good resource to learn how to do this.
We have a GWT web-app that we have been considering upgrading some components to Flutter, but I have not seen much information online on how to implement this.
I can't see documentation of this process online though. I have seen that you can insert Flutter into existing Android/IOS apps but I don't know how compatible this is with GWT.

FLUTTER WEB: How can we have a single codebase for the Flutter app & Web?

We have a single codebase for Android & iOS in Flutter.
We tried to use the same codebase for Web in Flutter too, but it hadn't gone well.
As of some libraries/plugins, currently unsupported by Flutter SDK.
To mitigate these issues, we are maintaining two separate repositories, one for Android-iOS and other for Web.
Also, to add up here, for separate repositories because each Flutter product has a unique pubspec.yaml file. Now there are a few plugins that are currently supported in App but Not yet on Flutter Web, namely Awesome Notifications, Clevertap plugin, etc.
Integrating those plugins on the web, stops the web to run. So keeping the same codebase for both is getting technically complicated as the app has many many functions.
It takes so much time in simultaneously testing, debugging and resolving issues in Web.
So, how we can maintain same code for all platforms i.e., Android, iOS & Web, without doing it in other repository for Web and gaining advantage in streamlining our codebase into one for all platforms?
For Ex. If I commented the package awesome_notifications for Web in pubspec file, the issue arises (as shown in the screenshot) in code wherever we used its functionalities.
For successfully working on both Mobile & Web, are there any methods available we can use packages for both (Mobile & Web)?
Ideally you’d want to use a single codebase to host both the web and mobile versions, to minimise code maintenance and improve efficiency. To do this, you’ll need to be able to find the platform the code is running on, so that code can be called programmatically.
You can use the constant kIsWeb to check if the application is compiled for the web, and you can then use that condition to only run platform-specific code (such as the awesome_notifications package) if you’re on a platform that supports it. That way you’ll still be able to import the required packages, but only call them when the app is running on the mobile version of your app.
That should allow you to condense your codebase into one repository without sacrificing any functionality that may not work across all platforms.

Flutter, one project for Mobile and web

Can I use one Flutter project to create web and mobile applications? if yes, How will I go about it, since some libraries that work with mobile might not work with the web? And how can I build a project such that the web pages do not fall into the production mobile app.
You can choose to limit your project to only the web platform or the mobile platform when building the project. Also, you can choose not to use any external library in your project.
If you want to check the platform that your app is run you can use the class Platform.
But be careful this class can be problematic for web so you should you kisweb
if (kisweb) {
// you're on web
}
Yes, you can but the question is should you? as flutter is now capable to support multiple platforms with a single code base. but the problem arises when you have to implement some complex functionalities into it and there are few packages that support all platforms that you want to deploy. So to tackle this either you have to ditch the idea to implement those functionalities or write your own package.

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.