typedItems<T> method

ItemsHandler<T> typedItems<T>(
  1. String collection, {
  2. required ItemsConverter<T> converter,
})

Get items from API with strong typings.

ItemsConverter must be provided that will convert data to and from json. If you don't care about types, use items, that will return Map. converter is a simple interface that converts value to and from JSON so it can be consumed with this API.

Implementation

ItemsHandler<T> typedItems<T>(String collection,
    {required ItemsConverter<T> converter}) {
  if (collection.startsWith('directus')) {
    throw DirectusError(
        message: "You can't read $collection collection directly.");
  }
  return ItemsHandler<T>(collection, client: client, converter: converter);
}