GrockDioServices class

😎😎😎😎😎😎 Grock package Dio Services 😎😎😎😎😎😎

  • With this class, you will be able to perform Restfull Api service operations more easily by using the dio package.
  • You can use it in your project by adding it to your pubspec.yaml file. Usefull Extensions


import 'package:grock/grock.dart';

void main() {
  GrockDioServices.instance.init(
    baseUrl: 'https://jsonplaceholder.typicode.com',
    connectTimeout: 5000,
    receiveTimeout: 3000,
    logger = GrockDioLogger.default(),
    setAuthorizationToken: () async {
      final tokenValue = await getToken();
      final mapData = {"Authorization": "Bearer $tokenValue"};
      return mapData;
    },
  );
  runApp(MyApp());
}

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

init({Dio? dio, required String baseUrl, int? connectTimeout, int? receiveTimeout, Map<String, dynamic>? headers, Map<String, dynamic>? queryParameters, Options? request, Future<Map<String, dynamic>?> setAuthorizationToken()?, BaseOptions? options, GrockDioLogger? logger}) → Future<void>
main.dart initialize BaseOptions
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → GrockDioServices
no setter

Static Methods

request({GrockDioType method = GrockDioType.get, required String path, Map<String, dynamic>? queryParameters, dynamic data, Options? options}) → Future<Response>
----------------- request example -----------------