-
-
Save vferreirati/04f61c8e782473ab9a79c1de8e26ded7 to your computer and use it in GitHub Desktop.
dart live templates
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
import 'package:chopper/chopper.dart'; | |
part '$FILENAME$.chopper.dart'; | |
@ChopperApi(baseUrl: '') | |
abstract class $SERVICE_NAME$ extends ChopperService { | |
static $SERVICE_NAME$ create([ChopperClient client]) => _$$$SERVICE_NAME$(client); | |
// endpoints | |
} |
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
{ | |
"New chopper service": { | |
"prefix": "chopper", | |
"body": [ | |
"import 'package:chopper/chopper.dart';", | |
"\npart '$1.chopper.dart';", | |
"\n@ChopperApi(baseUrl: '')", | |
"abstract class $2 extends ChopperService {", | |
"\tstatic $2 create([ChopperClient client]) => _$$2(client);", | |
"\n\t// Endpoints", | |
"\t$3", | |
"}" | |
], | |
"description": "Creates a new chopper service" | |
}, | |
"New Json Serializable Class": { | |
"prefix": "jclass", | |
"body": [ | |
"import 'package:json_annotation/json_annotation.dart';", | |
"\npart '$1.g.dart';", | |
"\n@JsonSerializable()", | |
"class $2 {", | |
"\n\tstatic $2 fromJson(Map<String, dynamic> json) => _$$2FromJson(json);", | |
"\tMap<String, dynamic> toJson() => _$$2ToJson(this);", | |
"}" | |
], | |
"description": "Creates a new Json Serializable class" | |
} | |
} |
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
import 'package:json_annotation/json_annotation.dart'; | |
part '$FILENAME$.g.dart'; | |
@JsonSerializable() | |
class $CLASSNAME$ { | |
static $CLASSNAME$ fromJson(Map<String, dynamic> json) => _$$$CLASSNAME$FromJson(json); | |
Map<String, dynamic> toJson() => _$$$CLASSNAME$ToJson(this); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment