remap 1.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new48

Remap

Map-based readers and writers for json and formurlencoded serialization and deserialization.

Examples

Use JsonReader and JsonWriter for json serialization and deserialization:

import 'package:remap/remap.dart';

void main() {
  final json = {
    'firstName': 'John',
    'lastName': 'Doe',
    'age': 20,
    'dateOfBirth': '1985-10-15'
  };

  final reader = new JsonReader.fromJson(json);
  final firstName = reader.readString('firstName');
  final lastName = reader.readString('lastName');
  final age = reader.readInt('age');
  final date = reader.readStringWith('dateOfBirth', (String s) => DateTime.parse(s));

  final writer = new JsonWriter();
  writer.writeString('firstName', firstName);
  writer.writeString('lastName', lastName);
  writer.writeInt('age', age);
  writer.writeStringWith('dateOfBirth', date, (DateTime s) => s.toIso8601String());

  print(writer.toJson());
  print(writer.toJsonString());
}

Use FormUrlEncodedReader and FormUrlEncodedWriter for formurlencoded serialization and deserialization:

import 'package:remap/remap.dart';

void main() {
  final data = 'firstName=John&lastName=Doe&age=20&dateOfBirth=1985-10-15';

  final reader = new FormUrlEncodedReader.fromFormUrlEncodedString(data);
  final firstName = reader.readString('firstName');
  final lastName = reader.readString('lastName');
  final age = reader.readInt('age');
  final date = reader.readStringWith('dateOfBirth', (String s) => DateTime.parse(s));

  final writer = new FormUrlEncodedWriter();
  writer.writeString('firstName', firstName);
  writer.writeString('lastName', lastName);
  writer.writeInt('age', age);
  writer.writeStringWith('dateOfBirth', date, (DateTime s) => s.toIso8601String());

  print(writer.toFormUrlEncoded());
  print(writer.toFormUrlEncodedString());
}

Changelog

1.0.0

  • Initial release

Use this package as a library

1. Depend on it

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


dependencies:
  remap: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:remap/remap.dart';
  
Version Uploaded Documentation Archive
1.0.1 Sep 5, 2018 Go to the documentation of remap 1.0.1 Download remap 1.0.1 archive
1.0.0 Sep 5, 2018 Go to the documentation of remap 1.0.0 Download remap 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:remap/remap.dart.

Suggestions

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use remap.dart.

Format lib/src/form/form_url_encoded_writer.dart.

Run dartfmt to format lib/src/form/form_url_encoded_writer.dart.

Format lib/src/json/json_reader.dart.

Run dartfmt to format lib/src/json/json_reader.dart.

Format lib/src/json/json_writer.dart.

Run dartfmt to format lib/src/json/json_writer.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0