session 0.3.5

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);
  }
}

0.3.5 #

  • set default errorOther.

0.3.4 #

  • result error.

0.3.3 #

  • return dynamic.

0.3.2 #

  • add get.
  • return result
  • set dio: ^2.1.13.

0.3.1 #

  • add merge.
  • add error.response.
  • set dio: ^2.1.10.

0.3.0 #

  • bugfix.
  • set dio: ^2.1.8.

0.2.4 #

  • add validWith.

0.2.3 #

  • revert "set models default value".

0.2.2 #

  • set dio: ^2.1.5.

0.2.1 #

  • add fillModel
  • add fillModels

0.2.0 #

  • add fillModel.

0.1.3 #

  • add Map.

0.1.2 #

  • add try catch.

0.1.1 #

  • code convert string.

0.1.0 #

  • add onResult.

0.0.3 #

  • bugfix.

0.0.2 #

  • update example.

0.0.1 #

  • initial release.

example/session.dart

/// More examples see https://github.com/OctMon/session/tree/master/example

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  session: ^0.3.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:session/session.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jul 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Primary library: package:session/session.dart with components: io.

Health suggestions

Fix lib/session.dart. (-0.50 points)

Analysis of lib/session.dart reported 1 hint:

line 148 col 31: Use isNotEmpty instead of length

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^2.1.13 2.1.13
Transitive dependencies
cookie_jar 1.0.1

Admin