json_serializable_dart

Last updated:

0 purchases

json_serializable_dart Image
json_serializable_dart Images
Add to Cart

Description:

json serializable dart

A library for Dart developers.
Usage #
A simple usage example:
import 'package:json_serializable_dart/serializable_json.dart';

part 'json_seriazable_dart_example.g.dart';

void main() {
final test = TestClass()..fromJson({'i': 1, 'm': 'ok'});
final copy = TestClass()..copyFrom(test);
copy.g = ["I\'copy"];
print(test.toMap());
print(copy.toMap());
}

@SerializableJson(methodOverlayName: 'Teradata', nullSafe: false)
class TestClass {
int? i;
late String m;
List<String>? g;

Map<String, dynamic> toMap() => _$TeradataToJson(this);

void fromJson(Map<String, dynamic> json) {
_$TeradataFromJson(this, json);
}

//for example copy instanse
void copyFrom(TestClass from) {
fromJson(from.toMap());
}
}

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.