getByIndex method

  1. @experimental
Future<OBJ?> getByIndex(
  1. String indexName,
  2. IndexKey key
)

Get a single object by the unique index indexName and key.

Returns null if the object does not exist.

If possible, you should use the generated type-safe methods instead.

Implementation

@experimental
Future<OBJ?> getByIndex(String indexName, IndexKey key) {
  return getAllByIndex(indexName, [key])
      .then((List<OBJ?> objects) => objects[0]);
}