getCollections method

  1. @override
Future<List<String>> getCollections()
override

Returns a list of all collection names in the database.

Implementation

@override
Future<List<String>> getCollections() async {
  final files = await _workDbInternal.ls(_root);

  // Extract unique collection names from the first level
  final collections = <String>{};

  for (final f in files) {
    final rel = f.replaceFirst('$_root/', '');
    final parts = rel.split('/');
    if (parts.isNotEmpty && parts[0].isNotEmpty) {
      collections.add(parts[0]);
    }
  }

  return collections.toList();
}