exec method

Future<bool> exec(
  1. {required int requiredStorageInGB}
)

Implementation

Future<bool> exec({
  required int requiredStorageInGB,
}) async {
  try {
    final availableStorageInGB =
        await _localStorageService.getAvailableStorageInGB();

    final hasEnoughSpace = availableStorageInGB >= requiredStorageInGB;

    return hasEnoughSpace;
  } on ServiceException catch (_) {
    throw UsecaseException(
      UsecaseErrorType.localStorageCheckError,
      UsecaseErrorType.localStorageCheckError.message,
    );
  } catch (e) {
    throw UsecaseException(
      UsecaseErrorType.unknown,
      UsecaseErrorType.unknown.message,
    );
  }
}