sizeFormPath method Null safety

Future<SizeFormPathResponse> sizeFormPath(
  1. {required String path}
)

Implementation

static Future<SizeFormPathResponse> sizeFormPath({required String path}) async {
  final Map<String, dynamic> params = <String, dynamic>{
    'path': path
  };


  if(path == ""){

    sizeFormFilePathResponse.value.status =  Status.error;
    sizeFormFilePathResponse.value.message = Status.errorMessage;

  }else{
    try {

        final String? response = await _channel.invokeMethod('sizeForLocalFilePath', params);

        if(response != "error"){

          sizeFormFilePathResponse.value.status =  Status.success;
          sizeFormFilePathResponse.value.message = Status.successMessage;
          sizeFormFilePathResponse.value.response = response;

        }else{

          sizeFormFilePathResponse.value.status =  Status.error;
          sizeFormFilePathResponse.value.message = Status.errorMessage;

        }

    } on Exception catch (exception) {

      sizeFormFilePathResponse.value.status =  Status.error;
      sizeFormFilePathResponse.value.message = exception.toString();

    } catch (e) {

      sizeFormFilePathResponse.value.status =  Status.error;
      sizeFormFilePathResponse.value.message = e.toString();

    }
  }

  return sizeFormFilePathResponse.value;
}