dart_json_mapper_built 0.0.1
dart_json_mapper_built: ^0.0.1 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

This is a dart-json-mapper complementary package provides support for https://pub.dev/packages/built_collection types in order to serialize / deserialize them from / to JSON.

pub package

This is a dart-json-mapper complementary package provides support for https://pub.dev/packages/built_collection 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_built:
dev_dependencies:
  build_runner:

Usage example lib/main.dart

import 'package:built_collection/built_collection.dart';
import 'package:dart_json_mapper/dart_json_mapper.dart' show JsonMapper, jsonSerializable;
import 'package:dart_json_mapper_built/dart_json_mapper_built.dart' show builtAdapter;

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

@jsonSerializable
class ImmutableClass {
  final BuiltList list;

  const ImmutableClass(this.list);
}

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

  print(JsonMapper.serialize(
     ImmutableClass(BuiltList.of([1, 2, 3]))
  ));
}

output:

{
  "list": [1,2,3]
}
0
likes
90
pub points
11%
popularity

This is a dart-json-mapper complementary package provides support for https://pub.dev/packages/built_collection types in order to serialize / deserialize them from / to JSON.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

alexander.mazuruk@gmail.com

License

BSD (LICENSE)

Dependencies

built_collection, dart_json_mapper

More

Packages that depend on dart_json_mapper_built