uploadFile method

Future<Map<String, dynamic>> uploadFile({
  1. required String stepName,
  2. required String fieldName,
  3. required List<int> fileBytes,
  4. required String fileName,
})

Upload a file to the backend for the given step.

Implementation

Future<Map<String, dynamic>> uploadFile({
  required String stepName,
  required String fieldName,
  required List<int> fileBytes,
  required String fileName,
}) async {
  _loading = true;
  notifyListeners();
  try {
    final response = await _apiService.uploadFile(
      stepName: stepName,
      fieldName: fieldName,
      fileBytes: fileBytes,
      fileName: fileName,
    );
    _loading = false;
    notifyListeners();
    return response;
  } catch (e) {
    _loading = false;
    notifyListeners();
    rethrow;
  }
}