dart_json_mapper_mobx 1.2.3
dart_json_mapper_mobx: ^1.2.3 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

This is a dart-json-mapper complementary package provides support for MobX Stores to persist as JSON.

example/example.dart

library json_mapper_mobx.example;

import 'package:dart_json_mapper/dart_json_mapper.dart'
    show JsonMapper, jsonSerializable, SerializationOptions;
import 'package:dart_json_mapper_mobx/dart_json_mapper_mobx.dart'
    show mobXAdapter;
import 'package:mobx/mobx.dart' show ObservableList;

import 'example.mapper.g.dart' show initializeJsonMapper;

@jsonSerializable
class MobX {
  ObservableList<String> mailingList = ObservableList<String>();

  MobX(this.mailingList);
}

void main() {
  initializeJsonMapper(adapters: [mobXAdapter]);

  final m = MobX(
      ObservableList<String>.of(['aa@test.com', 'bb@test.com', 'cc@test.com']));
  final targetJson = JsonMapper.serialize(m, SerializationOptions(indent: ''));
  final instance = JsonMapper.deserialize<MobX>(targetJson);

  // Serialized object
  print(targetJson);

  // Deserialize object
  print(instance);
}
5
likes
100
pub points
77%
popularity

Publisher

edensapple.com

This is a dart-json-mapper complementary package provides support for MobX Stores to persist as JSON.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

dart_json_mapper, mobx

More

Packages that depend on dart_json_mapper_mobx