read method

Future<DirectLinkSlug?> read()

Returns the DirectLinkSlug stored in the database, if any.

Implementation

Future<DirectLinkSlug?> read() async {
  Log.debug('read()', '$runtimeType');

  return await safe<DirectLinkSlug?>((db) async {
    final stmt = db.select(db.slugs)..where((u) => u.id.equals(0));
    final SlugRow? row = await stmt.getSingleOrNull();
    Log.debug('read() -> $row', '$runtimeType');

    if (row == null) {
      return null;
    }

    return DirectLinkSlug.unchecked(row.slug);
  }, tag: 'slugs.read()');
}