joaopaulofcc

Untitled

Nov 11th, 2020
532
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Dog {
  2.   final int id;
  3.   final String name;
  4.   final int age;
  5.  
  6.   Dog({this.id, this.name, this.age});
  7.  
  8.   Map<String, dynamic> toMap() {
  9.     return {
  10.       'id': id,
  11.       'name': name,
  12.       'age': age,
  13.     };
  14.   }
  15.  
  16.   static fromMap(Map<String, dynamic> map) {
  17.     return new Dog(id: map['id'], name: map['name'], age: map['age']);
  18.   }
  19.  
  20.   @override
  21.   String toString() {
  22.     return 'Dados do cachorro $id - Nome: $name, Idade: $age';
  23.   }
  24. }
RAW Paste Data