Last active
June 7, 2018 03:20
-
-
Save buntagonalprism/0f38f37ef0bb76bf27050f1d138e1ae5 to your computer and use it in GitHub Desktop.
Individual Dart JSON Model class template file for inclusion in Medium article
This file contains hidden or 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
#set( $nameparts = $NAME.split("_")) | |
#set( $namepart = '') | |
#set( $classname = '') | |
#foreach( $namepart in $nameparts ) | |
#set( $classname = $classname + $namepart.substring(0, 1).toUpperCase() + $namepart.substring(1)) | |
#end | |
import 'package:json_annotation/json_annotation.dart'; | |
part #[[']]#$NAME#[[.g.dart']]#; | |
@JsonSerializable() | |
class $classname extends Object with _#[[$]]#${classname}SerializerMixin { | |
// TODO: add class properties and constructor parameters | |
$classname(); | |
factory $classname#[[.fromJson(Map<String, dynamic> json) => _$]]#${classname}FromJson(json); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment