list method

Future<List<String>> list()

Returns the complete list of data indexes.

Implementation

Future<List<String>> list() async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'list',
  ));

  final result = response.result as Map<String, dynamic>?;

  if (result != null && result.containsKey('indexes')) {
    if (result['indexes'] is List) {
      return (result['indexes'] as List<dynamic>)
          .map<String>((a) => a as String)
          .toList();
    }
  }

  throw BadResponseFormatError(
      response.error?.id, '$name.list: bad response format', response);
}