dart_json_mapper_flutter 1.0.1

Flutter Android iOS web

This is a dart-json-mapper complementary package provides support for https://github.com/flutter/flutter types in order to serialize / deserialize them from / to JSON.

pub package

This is a dart-json-mapper complementary package provides support for https://github.com/flutter/flutter types in order to serialize / deserialize them from / to JSON.

Basic setup #

Beforehand please consult with basic setup section from dart-json-mapper package.

Please add the following dependencies to your pubspec.yaml:

dependencies:
  dart_json_mapper:
  dart_json_mapper_flutter:
dev_dependencies:
  build_runner:

Usage example lib/main.dart

import 'dart:ui' show Color;
import 'package:dart_json_mapper/dart_json_mapper.dart' show JsonMapper, jsonSerializable;
import 'package:dart_json_mapper_flutter/dart_json_mapper_flutter.dart' show flutterAdapter;

import 'main.reflectable.dart' show initializeReflectable;

@jsonSerializable
class FlutterClass {
  Color color;

  FlutterClass(this.color);
}

void main() {
  initializeReflectable();
  JsonMapper().useAdapter(flutterAdapter);
  
  print(JsonMapper.serialize(
     FlutterClass(Color(0x003f4f5f))
  ));
}

output:

{
  "color": "#003F4F5F"
}
4
likes
100
pub points
79%
popularity

Publisher

edensapple.com

This is a dart-json-mapper complementary package provides support for https://github.com/flutter/flutter types in order to serialize / deserialize them from / to JSON.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

dart_json_mapper, flutter

More

Packages that depend on dart_json_mapper_flutter