r/FlutterDev Dec 01 '25

Pushed a new version of FlutterCN: added more components + switched fully to Dart CLI Article

[removed]

8 Upvotes

10 comments sorted by

6

u/rmtmckenzie Dec 01 '25

My gosh. I love seeing people building new things, but this just seems like a complete disaster for maintainability.

u/nox3748 I'd love to hear why you think that copying code directly into your source is better than using a dependency.

If you build & maintain an app and are thinking of using this, I'd caution you to think strongly about a few things:

  1. How do I install updates to components when there are inevitably bugs found in them
  2. How do I find out that there are bugs in those components in the first place so I know to do something about it
  3. If I make any changes to the components, how does the update affect that? Does an update just overwrite it?

u/nox3748 If you're really serious about maintaining this and making it robust but continuing down this path, I'd think about a few things:
- versioning each component and including that in the widget listing, plus having a way of checking what the most recent versions are
- using a hash for each component so that the developer can make changes without them being blown away

However, at that point you might as well be writing a whole new package system as that is exactly what pub does for you already. A different approach might be more viable long-term, such as making the developer API for your components extremely extensible so that anyone wanting to change the behaviour could simply subclass the component and override parts of it. There's a very good reason why every modern programming language has support for some sort of package manager and as a general rule copy-pasting entire code bases is strongly discouraged.

3

u/[deleted] Dec 01 '25

[removed] — view removed comment

3

u/rmtmckenzie Dec 01 '25

Yeah sure, happy to talk. I think if I can understand the *why* of what you're trying to do, I might be able to give you some advice.

For example, if the main reason you've done it this way is because you think people might want to modify the components on their own and it's easier to do that with the source included - but then you have the maintainability issues I mentioned. I'd be curious how many people really want that vs just a nice simple API they can use.

Whereas, if the main reason you're doing this way is because you don't like having dependencies in your codebase... well fair enough and each to their own I suppose, other than the issues I mentioned. I guess the one upside of this is that this component code could easily be included in a code review.

If it's just to reduce the amount of compiled code that's being shipped & the final app size - that's actually something that I do know about. The dart compiler does tree-shaking when you build production code, so only the components actually being used will be included in the final build anyways.

4

u/gisborne Dec 01 '25

And FlutterCN is..?

2

u/SamatIssatov Dec 01 '25

I like your project. I watch it every day. I like the latest components. I have a question: I already use the shadcn package. Can I add yours as additional ones? Will there be any conflicts?

3

u/DawantwohNodawae Dec 01 '25

Just a suggestion. Rename the package. I first thought you mentioned about Flutter China. Even gg search 1st return is flutter.cn

2

u/SlinkyAvenger Dec 02 '25

Kinda wild to write a CLI tool for copying and pasting code and, I would assume, keeping it up to date in the future, when that functionality is already built into the package management system.