main function

void main()

Implementation

void main() async {
  // Temporary path
  final path = Directory.systemTemp.path;

  // Creates cache with a Objectbox based storage backend with the capacity of 10 entries
  final cache = newObjectBoxCache(path,
      maxEntries: 10, fromEncodable: (json) => Task.fromJson(json));

  // Adds a task with key 'task1' to the cache
  await cache.put('task1',
      Task(id: 1, title: 'Run stash_objectbox example', completed: true));
  // Retrieves the value from the cache
  final value = await cache.get('task1');

  print(value);
}