Dart & Flutter library to communicate with a Directus REST API

I’ve created this lib to use internally on many Flutter project I was working on.
But I’m also a Teacher at https://www.purplegiraffe.fr/ where I teach about Flutter and Directus ; therefore many of my students were requesting help to communicate with their Directus instance.

I decided to open-source this lib and some of my students started to contribute nice features on it. Main features are :

  • Authentication management with automatic token refresh and the possibility to save restore tokens,
  • Create one class per collection en enjoy automatic parsing and url building,
  • One DirectusApiManager class with most of the useful functions,
  • Support for CRUD over each collection,
  • Support for websockets,
  • Local caching engine to limit the number of request to the directus instance,
  • Helper classes for filters and sort properties,
  • Support for File uploads,
  • Automated tests,

What should be improved :

  • Documentation should be enough to get started but advanced features needs more love on that part,

Sources : GitHub - maxbritto/directus_api_manager: Dart & Flutter library to communicate with a Directus REST API

I hope you’ll find it useful.
Happy Coding!

7 Likes

Have you read this? Fetch Data From Directus with Flutter | Directus Docs

Personally, I use Flutterflow and Directus.

Thanks for the link!
This tutorial is really basic and mostly is a Flutter beginner tutorial on how to call an API.
All the complicated parts of the Directus API are not in this tutorial : authentification, refreshing of tokens after a certain times, use of filters, etc.
The tutorial probably uses an all public collection for demo purposes but this not what would be used in production.
This lib I’ve shared manages all of this and beyond (caching, json parsing, smart updating, etc.)

1 Like