Last active
June 28, 2021 10:08
-
-
Save imsaravana369/02dc1ed07bc79fd5b8708355e09db608 to your computer and use it in GitHub Desktop.
Dart Named Constructor example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
late final String name; | |
late final int age; | |
Person(this.name,this.age); | |
Person.fromJson(Map<String,dynamic> json){ | |
this.name = json['name']; | |
this.age = json['age'] as int; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment