mx_request_generator 1.0.0 copy "mx_request_generator: ^1.0.0" to clipboard
mx_request_generator: ^1.0.0 copied to clipboard

可使用annotation生成API的工具, 搭配mx_request使用

example/mx_request_generator_example.dart

import 'package:dio/dio.dart';
import 'package:mx_request/mx_request.dart';

import 'request.dart';

void main() async {
  // 初始化http請求工具
  final dio = Dio();

  // 初始化api接口實體
  final request = ExRequest();

  print('發出請求');

  // 發出http api請求, 並取得響應
  await dio
      .mxRequest(request.exApi(
    'apiPath',
    'hi',
    'bToken',
    'cBody',
    'rawBody',
    opBodyFile: MultipartFile.fromString('value'),
    check: 'check',
    opId: 'opId',
    opId2: ['opId2'],
  ))
      .then((value) {
    print('響應: $value');
  }).catchError((e, s) {
    print('錯誤: $e');
  });
}
0
likes
125
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

可使用annotation生成API的工具, 搭配mx_request使用

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

analyzer, build, built_collection, code_builder, dart_style, meta, mx_request, source_gen

More

Packages that depend on mx_request_generator