md_api_service 0.0.2 copy "md_api_service: ^0.0.2" to clipboard
md_api_service: ^0.0.2 copied to clipboard

A Base API Service to use single Dio for multiple host and make model mapping easier.

example/lib/main.dart

import 'package:md_api_service/api_service.dart';

import 'api_service.dart';
import 'inputs/api_input.dart';
import 'models/todo.dart';

void main(List<String> arguments) async {
  Log.logPrint = print;
  final apiService = APIService();

  final postTodoAPIInput = PostTodoAPIInput(todo: Todo(1, 1, 'abc', false));
  try {
    final response = await apiService.requestJSONObject(
      postTodoAPIInput,
      mapper: Todo.fromJson,
      options: NetworkRequestOptions(
        printToCurl: true,
      ),
    );

    Log.json(response);
  } catch (error, stackTrace) {
    Log.e('', time: DateTime.now(), error: error, stackTrace: stackTrace);
  }
}
0
likes
160
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

A Base API Service to use single Dio for multiple host and make model mapping easier.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

dartx, dio, flutter, logger

More

Packages that depend on md_api_service