dart_mappable 0.1.0 copy "dart_mappable: ^0.1.0" to clipboard
dart_mappable: ^0.1.0 copied to clipboard

outdated

Generate typesafe code to serialize / deserialize dart objects without any extra boilerplate code.

example/lib/main.dart

import 'main.g.dart';


class Person {
  dynamic age;
  String name;
  bool isAdmin;
  Car? car;
  List<int> nums;
  List<Car> cars;

  Person(this.name, this.age, {this.car, this.isAdmin = false, this.nums = const [], required this.cars});
}

class Animal {
  int age;
  Animal(this.age);
}

class Dog extends Animal {
  String breed;
  Dog(this.breed, int age) : super(age);
}

enum Brand {
  Toyota, Audi, BMW
}

class Car {
  final Brand brand;
  final int miles;

  const Car(this.miles, this.brand);
}

void main() {


  Car(2, BrandMapper.fromString("asd"));


  Dog d = ObjectMapper.fromMap({"age": 10, "breed": "Shiba"});

  print(d.toMap());

}
321
likes
0
pub points
97%
popularity

Publisher

verified publisherschultek.de

Generate typesafe code to serialize / deserialize dart objects without any extra boilerplate code.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, indent

More

Packages that depend on dart_mappable