chopper_client_wrapper 1.0.1+2 copy "chopper_client_wrapper: ^1.0.1+2" to clipboard
chopper_client_wrapper: ^1.0.1+2 copied to clipboard

This package is a wrapper class that you can use to save time while setting up files for integrating apis. You just have to extend our class and follow the steps.

example/lib/main.dart

import 'dart:async';

import 'package:chopper/chopper.dart';
import 'package:chopper_client_wrapper/ChopperService/ChopperClientWrapper.dart';

void main() {}

class MyChopperClient extends ChopperClientWrapper {
  
  /// Example
  /// LoginResponseModel : LoginResponseModel.fromJson
  /// We have a model caled LoginRsponseModel which is model for the response that comes when user login successfully
  /// LoginResponseModel.fromJson is factory constructor of LoginResponseModel that converts Map to LoginResponseModel object
  @override
  Map<Type, JsonConvertorFunction> get jsonToModelConvertorMap => {};
  @override
  Map<Type, JsonConvertorFunction> get jsonToErrorModelConvertorMap =>{};
  /// My base url
  @override
  String get baseUrl => 'https://myapi.com';
  @override
  List<ChopperService> get chopperServices => [
// List of Chopper services that you create for your application
      ];
/// return a token that will be used for authentication inside header
  @override
  FutureOr<String> getToken() {
    return 'mytoken';
  }

/// you can even set header parameters here if you want to change default set in the package
  @override
  Map<String, String> getHeaderParameters(){
    return {};
  }
}
4
likes
140
pub points
0%
popularity

Publisher

verified publishertechypanther.com

This package is a wrapper class that you can use to save time while setting up files for integrating apis. You just have to extend our class and follow the steps.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

chopper, flutter

More

Packages that depend on chopper_client_wrapper