Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter is developed in modules, and each module can run independently #147847

Closed
LanSeLianMa opened this issue May 5, 2024 · 26 comments
Closed
Labels
r: invalid Issue is closed as not valid

Comments

@LanSeLianMa
Copy link

LanSeLianMa commented May 5, 2024

Document Link

https://github.com/LanSeLianMa/flutter_module_develop

What problem are you solving?

I implemented module development by using Flutter's named routing method, and each module can run independently. My demo includes Provider.

  1. Create a new empty folder
  2. Create Flutter project module
  3. Set the startup entrance for each Flutter project module
  4. Associate them in pubspec.yaml

Step illustration:

  1. Create a new empty folder
01
  1. Create Flutter project module
02 03 04 05 06 07
  1. Set the startup entrance for each Flutter project module
08 09 10 11

I will omit showing other module creation processes here because they are all the same.
12

  1. Associate them in pubspec.yaml

4.1 common module adds dependencies
13

4.2 home, order, personal modules pubspec.yaml dependencies common module
14

4.3 the app module depends on the home, order, and personal modules
15

  1. dependence mind map
16
  1. final effect
    demo

demo link
https://github.com/LanSeLianMa/flutter_module_develop

I would like to ask if this Flutter development method can be formally applied in actual projects?

@LanSeLianMa LanSeLianMa added the design doc Tracks a design discussion document label May 5, 2024
@flutter-triage-bot flutter-triage-bot bot added the 📜 Design doc announcement was posted to Discord. Remove to have the issue reannounced. label May 5, 2024
@AbdeMohlbi
Copy link

AbdeMohlbi commented May 5, 2024

I think it would be helpful to explain when and how to use this by providing a use case. Imo, one of the tricky things about Flutter modules is that when your UI has multiple parts and you're using bloc or provider, each part ends up doing the same thing. So, if you update one part, it could mess up the whole project because you can't rely on two different versions of the same package
Also imagine having to deal with gradle configuration for each one of ur modules when there is a breaking change like what happend in 3.16
Also i see a the bundle got 2.5 times bigger i don't think this is a good thing
Maybee there is somewhere to fit just i don't see it

@AbdeMohlbi
Copy link

AbdeMohlbi commented May 5, 2024

What's more intersseting is how to deal with assets in this case is it possible to pass them up and down between modules ?

@LanSeLianMa
Copy link
Author

I tried pictures and fonts, but they all failed. By default, it reads the package path of the startup module, which is com.example.app. I used the package attribute to make changes, but they all failed. Why is this? Is there any solution?

17 18 19 20

@indeedshaw
Copy link

Can it be understood that these modules are currently just plugins and not real modules?

@LanSeLianMa
Copy link
Author

It is a real module and can be started independently, similar to Android native sub-module development.

@AbdeMohlbi
Copy link

It is a real module and can be started independently, similar to Android native sub-module development.

Tbh he is right what we have here is a mix between the two kinda modules shaped inside a plugin

@LanSeLianMa
Copy link
Author

I think it would be helpful to explain when and how to use this by providing a use case. Imo, one of the tricky things about Flutter modules is that when your UI has multiple parts and you're using bloc or provider, each part ends up doing the same thing. So, if you update one part, it could mess up the whole project because you can't rely on two different versions of the same package Also imagine having to deal with gradle configuration for each one of ur modules when there is a breaking change like what happend in 3.16 Also i see a the bundle got 2.5 times bigger i don't think this is a good thing Maybee there is somewhere to fit just i don't see it

What does this bundle refer to? I created a new Flutter project. The packaged volume is 17.4MB, while the packaged volume of the multi-module Flutter project is 17.9MB. This volume should be acceptable, and there is no 2.5 times the volume.

21 22

@AbdeMohlbi
Copy link

See the project size in ur disk

@LanSeLianMa
Copy link
Author

I thought it was the packaging size. This shouldn’t be a problem. Most developers’ productivity tools have enough capacity.

@LanSeLianMa
Copy link
Author

Now there is only one problem left, how to solve the problem of access of local resources between various modules

@darshankawar darshankawar added in triage Presently being triaged by the triage team and removed design doc Tracks a design discussion document 📜 Design doc announcement was posted to Discord. Remove to have the issue reannounced. labels May 6, 2024
@darshankawar
Copy link
Member

Removing design doc label as it doesn't seem to be applicable here.

@AbdeMohlbi
Copy link

@LanSeLianMa
Also is it possible to share variables between modules back and forth

@LanSeLianMa
Copy link
Author

As long as it is added in the common module, other modules can access it, but the compiler will not prompt you. You need to import the package manually. However, when importing the package, the compiler will prompt you.

@AbdeMohlbi
Copy link

AbdeMohlbi commented May 6, 2024

@LanSeLianMa
Hmmm Intersseting
maybe a use case i can think about is to store some logic inside a seperate module not a ui component then it can be helpfull something like hashing or parsing
What do u think?

@darshankawar
Copy link
Member

darshankawar commented May 6, 2024

ask if this Flutter development method can be formally applied in actual projects?

@LanSeLianMa Can you elaborate when you say to formally apply in actual projects ? Are you proposing to add this as an option in the sdk itself ? By the looks of it and your findings so far, it seems there are lot of open end cases that you'll need to cover, consider and test before presenting the idea.

Also, check if this resembles your case or not.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 6, 2024
@LanSeLianMa
Copy link
Author

请问这种Flutter开发方式可以正式应用到实际项目中吗?

@LanSeLianMa您说要正式应用到实际项目中,能详细说明一下吗?您是否建议将其添加为 sdk 本身的选项?从它的外观和您迄今为止的发现来看,在提出这个想法之前,您似乎需要主题、考虑和测试许多开放式案例。

另外,请检查是否与您的情况相似。

No need to add it to the SDK, I just want to ask if this development method is feasible

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 6, 2024
@LanSeLianMa
Copy link
Author

@LanSeLianMa 嗯, 也许我能想到一个简单的逻辑存储在单独的模块而不是 ui 组件中,那么它可能会有帮助,例如散列或解析, 你觉得怎么样?

In fact, it is just to make the project structure clearer. The remaining problem is how to access local files across modules.

@darshankawar
Copy link
Member

@LanSeLianMa
I think this is better to be asked on discord channel for the feasibility rather than asking it here, because it doesn't seem to be a bug report or a feature request but a question whether this approach is feasible or not.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 7, 2024
@LanSeLianMa
Copy link
Author

Okay, do you have any recommendations for relevant platforms?

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 7, 2024
@LanSeLianMa
Copy link
Author

Communities with more active official attention can also be used

@darshankawar
Copy link
Member

darshankawar commented May 7, 2024

@LanSeLianMa
You may post the same in flutter's discord channels as mentioned here for feedback on your idea.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 7, 2024
@LanSeLianMa
Copy link
Author

I choose Twitter

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 7, 2024
@LanSeLianMa
Copy link
Author

This channel https://twitter.com/r_FlutterDev

@FusoraTech
Copy link

@LanSeLianMa
Copy link
Author

OK, I have successfully entered the Flutter community channel

截屏2024-05-07 22 40 46

@darshankawar
Copy link
Member

Closing from here as you can track and follow-up in other platforms to get feedback your on idea.

@darshankawar darshankawar closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
@darshankawar darshankawar added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

5 participants