Pub support

session

Network request result

json to dart https://javiercbk.github.io/json_to_dart/

Getting Started

Add dependency

dependencies:
  session: ^0.3.5  #latest version

Example

import 'package:session/session.dart';

Session session = Session(
  config: Config(
    baseUrl: 'https://api.tuchong.com/',
    // proxy: 'PROXY localhost:8888',
    connectTimeout: 5,
    receiveTimeout: 5,
    code: 'result',
    list: 'feedList',
    validCode: 'SUCCESS',
  ),
);

void example() async {
  Result result = await session.request('feed-app', data: {'page': _counter});
  if (result.valid) {
    result.fillList(result.list.map((json) => Model.fromJson(json)).toList());
    print(result.models.length);
  }
}

Libraries

session