createData method

  1. @override
Future<void> createData(
  1. String collectionId,
  2. String mid,
  3. Map data
)
override

Implementation

@override
Future<void> createData(String collectionId, String mid, Map<dynamic, dynamic> data) async {
  await initialize();

  try {
    logger.finest('createData($mid),($collectionId)');
    String key = HycopUtils.midToKey(mid);
    logger.finest('createData($key)');
    await database!.createDocument(
      databaseId: myConfig!.serverConfig.dbConnInfo.appId,
      collectionId: collectionId,
      documentId: key,
      data: data,
    );
  } on AppwriteException catch (e) {
    if (e.message != null) {
      throw HycopException(message: e.message!, code: e.code);
    }
    throw HycopException(message: 'Appwrite error', code: e.code);
  }
}