encrypt method

String encrypt({
  1. required Map data,
  2. required DatabaseMiniGeneralLibraryBaseOptions databaseMiniGeneralLibraryBaseOptions,
})

Implementation

String encrypt({
  required Map data,
  required DatabaseMiniGeneralLibraryBaseOptions
      databaseMiniGeneralLibraryBaseOptions,
}) {
  if (databaseMiniGeneralLibraryBaseOptions.isUseCrypto) {
    try {
      return databaseMiniGeneralLibraryBaseOptions.crypto
          .encrypt(data: json.encode(data));
    } catch (e) {
      if (databaseMiniGeneralLibraryBaseOptions.isIgnoreError == false) {
        rethrow;
      }
      return "";
    }
  } else {
    try {
      return json.encode(data);
    } catch (e) {
      if (databaseMiniGeneralLibraryBaseOptions.isIgnoreError == false) {
        rethrow;
      }
      return "";
    }
  }
}