getAllData method

  1. @override
Future<List> getAllData(
  1. String collectionId
)
override

Implementation

@override
Future<List> getAllData(String collectionId) async {
  await initialize();

  try {
    final result = await database!.listDocuments(
        databaseId: myConfig!.serverConfig.dbConnInfo.appId, collectionId: collectionId);
    return result.documents.map((element) {
      return element.data;
    }).toList();
  } on AppwriteException catch (e) {
    if (e.code == 404) {
      logger.finest(e.message!);
      return [];
    }
    if (e.message != null) {
      throw HycopException(message: e.message!, code: e.code);
    }
    throw HycopException(message: 'Appwrite error', code: e.code);
  }
}