get method Null safety

Future<Response> get(
  1. String url,
  2. {Duration? timeout,
  3. Map<String, String> params = const {},
  4. Map<String, String> headers = const {},
  5. ResponseType responseType = ResponseType.json,
  6. DownloadCallback? onDownloadProgress,
  7. ValidateCallback? validateStatus}
)

Aliase to GET method.

Implementation

Future<Response> get(
  String url, {

  /// Time that the server will wait for the response to the request.
  /// The connection will be interrupted if you hear timeout.
  Duration? timeout,

  /// Adds query params.
  /// Must be a plain object or a URLSearchParams object.;
  /// exe:
  ///```dart
  /// uno.get('/users',params: {
  ///   'id': '1',
  /// });
  /// ```
  /// This generate ['/users?id=1'];
  Map<String, String> params = const {},

  /// Headers of request.
  Map<String, String> headers = const {},

  /// Represents the [Response] data type.
  /// Could use:
  /// ```dart
  /// ResponseType.json //default
  /// ResponseType.plain
  /// ResponseType.arraybuffer
  /// ResponseType.stream
  /// ```
  ResponseType responseType = ResponseType.json,

  /// Callback from API to client about request`s upload.
  /// ```dart
  ///  uno(
  ///  method: 'get',
  ///  url: 'http://bit.ly/2mTM3nY',
  ///  // you can use plain, json(default), arraybuffer and stream;
  ///  responseType: ResponseType.arraybuffer,
  ///  onDownloadProgress: (total, current) {
  ///    final percentCompleted = (current / total * 100).round();
  ///    print('completed: $percentCompleted%');
  ///  },
  /// ).then((response) async {
  ///   await File('ada_lovelace.jpg').writeAsBytes(response.data);
  /// });
  /// ```
  DownloadCallback? onDownloadProgress,

  /// Using the validateStatus config option, you can define HTTP code(s) that should throw an error.
  /// ```dart
  /// axios.get('/user/12345', {
  ///   validateStatus: (status) {
  ///     return status < 500; // Resolve only if the status code is less than 500
  ///   }
  /// });
  /// ```
  ValidateCallback? validateStatus,
});