Tony Borchert
Tony Borchert

Reputation: 182

Questions on structuring a flutter(-bloc) app

Say I have an App that uses Blocs/Cubits and I have a few repositories, like a AuthRepository and a FriendsRepository.

Now the problem is the following: I want the repositories to be in different packages than the actual app, like such:

|-app
  |-lib
    |...
  |-pubspec.yaml
|-auth_repository
  |-lib
    |...
  |-pubspec.yaml
|-friends_repository
  |-lib
    |...
  |-pubspec.yaml

How would I share the models?

Am I not allowed to use the models inside the repositories/do I have to have special models that are converted by the blocs/cubits to ones in the app?

Or do I make another package with the shared models?

Or should I just make a folder in lib to house the repositories and then just share the models in the lib/models folder?

Upvotes: 0

Views: 163

Answers (1)

lordyhas
lordyhas

Reputation: 502

if you want to create your own flutter package click here.
And also if you want, you can get inspiration from the example here, it's an example of a firebase login application with an AuthenticationRepository in different packages, as you're looking for. Just look at its structure it can help you.

Upvotes: 1

Related Questions