remap 1.1.0

Dart native js
Flutter Android iOS web

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

Remap #

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

API docs

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());
}
0
likes
80
pub points
26%
popularity

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

Repository (GitHub)
View/report issues

Documentation

API reference

Uploaders

alexander.polyankin@team.wrike.com
maxim.grebenshikov@team.wrike.com

License

MIT (LICENSE)

More

Packages that depend on remap