Created
March 24, 2021 08:35
-
-
Save HosseinYousefi/ab7ed90d6d2261dcd7e101f4dc1a49ac to your computer and use it in GitHub Desktop.
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
{ | |
"Part statement": { | |
"prefix": "pts", | |
"body": [ | |
"part '${TM_FILENAME_BASE}.g.dart';", | |
], | |
"description": "Creates a filled-in part statement" | |
}, | |
"Part 'Freezed' statement": { | |
"prefix": "ptf", | |
"body": [ | |
"part '${TM_FILENAME_BASE}.freezed.dart';", | |
], | |
"description": "Creates a filled-in freezed part statement" | |
}, | |
"Freezed Data Class": { | |
"prefix": "fdataclass", | |
"body": [ | |
"@freezed", | |
"abstract class ${1:DataClass} with _$${1:DataClass}{", | |
" const factory ${1:DataClass}(${2}) = _${1:DataClass};", | |
"}" | |
], | |
"description": "Freezed Data Class" | |
}, | |
"Freezed Union": { | |
"prefix": "funion", | |
"body": [ | |
"@freezed", | |
"abstract class ${1:Union} with _$${1:Union}{", | |
" const factory ${1:Union}.${2}(${4}) = ${3};", | |
"}" | |
], | |
"description": "Freezed Union" | |
}, | |
"Freezed Union Case": { | |
"prefix": "funioncase", | |
"body": [ | |
"const factory ${1:Union}.${2}(${4}) = ${3};" | |
], | |
"description": "Freezed Union Case" | |
}, | |
"fromJson": { | |
"prefix": "fromJson", | |
"body": [ | |
"factory ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}.fromJson(Map<String, dynamic> json) => _$${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}FromJson(json);" | |
], | |
"description": "fromJson function" | |
}, | |
"New Adaptor": { | |
"prefix": "nadaptor", | |
"body": [ | |
"class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}Adapter extends TypeAdapter<${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}> {", | |
" @override", | |
" // TODO: implement typeId", | |
" int get typeId => throw UnimplementedError();", | |
"", | |
" @override", | |
" ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} read(BinaryReader reader) {", | |
" return ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}.fromJson(reader.readMap() as Map<String, dynamic>);", | |
" }", | |
"", | |
" @override", | |
" void write(BinaryWriter writer, ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} obj) {", | |
" writer.write(obj.toJson());", | |
" }", | |
"}" | |
], | |
"description": "Makes a Hive adapter", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks Hossein, amazing