xmapper 1.0.3 copy "xmapper: ^1.0.3" to clipboard
xmapper: ^1.0.3 copied to clipboard

outdated

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');
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A starting point for Dart libraries or applications.

License

unknown (LICENSE)

More

Packages that depend on xmapper