
I'm having trouble using Appwrite. More in a sense of how do I organise my code. This is because I'm learning coding/Flutter and started using Appwrite as my backend.
I've been using the Flutter provider package and I've been wondering, are fellow Flutter devs also making an Appwrite provider in which you can call the various functions? I would love to hear your stories and I hope to get some insight and eventually a direction(s?) in which I can go at it.
Just to give some context, I have an app in which I want to create notes after my workout. I've designed the screens and models. Now got stuck on something simple. Importing Appwrite in every page is not really maintainable; So what are my options?
I've added some screenshots for context. Thank you in advance fam! ❤️

there is an existing AppWrite flutter package @nebukadnezar


Thank you for replying. I meant as in how to architect a Flutter app with Appwrite? I'm reading about repository pattern for example

when reading about stuff online, i would read for general architecture/organization and then apply those using Appwrite.
For example, a common approach is to create repositories or services for your business logic or resources so the appwrite SDK would be used in one of those classes

Create service classes that create different methods like createNewNote, deleteNote etc. and then create providers that call those service methods. And use the providers everywhere in your app.

thank you; this is insightful feedback. Do you use interfaces to make it more modular?

What do you mean by interfaces in dart?

I mean to have to a service class with the different methods just as you said. Also creating an interface that the service uses if I ever want to change my service in the future. Would that be a good idea?

I directly define the methods & change the logic in the service class. You can also use an interface (abstract class) for easier mock testing but I don't do it.
In both ways the main benefit is you don't have to change the provider and any of its use in the app even if you decide to change a service.

Thanks man, I'll give it a go

Need anything else or can this be marked as solved?

Thanks Steve, you can mark this as solved. I don’t know how to do that 🫣

[Solved] Design patterns with Appwrite Flutter
Recommended threads
- Delete account on authentication
I'm building an authentication that need to a user a choice of delete their account when they need and on the documentation, if I find delete sessions or sessio...
- Existing ID bug?!
Idk why this happens can someone explain!! why Im getting this error even if I "manually clear the collection" ?
- Constant 404 Pages
Whenever I am navigating through items and pages to go through my collections and database I end up at a page that sends me a 404 error, if i refresh it remains...
