Flutter define enum in one file, add to it in another

Viewed 50

Enums, by design, are constant, so I'm assuming there probably isn't a built-in way to do this, but I wanted to check.

I wanted to create a core set for my apps that I can adapt to a package that all my apps can share.

The core has two pieces of functionality that depend on Enums. Routing, and Member Permissions (mirrored and double-checked by the server). The members of each enum will vary from app to app, though there will be some common points (routing: home, terms, privacy, login, forgot password, etc)

Is there a way that I can create an enum in my core package and add to it in the app that invokes the core package?

Are there any enum packages that can enable this?

One of the reasons that I like enums is that I can iterate through .values to find the route when a user comes to the website/app.

Class members can't be iterated through dynamically, which is why I prefer enums.

I can manually mimic a values field, but I was looking for a way to use enums first.

0 Answers
Related