xmapper 1.0.2 xmapper: ^1.0.2 copied to clipboard
A starting point for Dart libraries or applications.
example/xmapper_example.dart
import 'package:xmapper/xmapper.dart';
class A {
late int fd1;
late String fd2;
late bool fd3;
late List<B> bs;
A({this.fd1 = 0, this.fd2 = '', this.fd3 = false}) {
bs = <B>[];
}
@override
String toString() => '$fd1 - $fd2 - $fd3\n$bs';
}
class B {
late String testS;
late double fee;
B({this.testS = '', this.fee = 0.0});
@override
String toString() => '$testS - $fee';
}
void main() {
final obj = Mapper<A>().object({
'fd1': 1,
'fd2': 'hahahah',
'bs': [
{'test_s': 'asdasdas'},
{'test_s': 'rtgrgreg'}
],
});
print('obj: $obj');
final map = Mapper<A>().toMap(obj!);
print('map: $map');
}