Created
February 12, 2021 16:50
-
-
Save debkanchan/9c699b1067425e86344bc2fd87831fb5 to your computer and use it in GitHub Desktop.
Flutter/Dart Freezed Snippets
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
{ | |
"Freezed Class": { | |
"prefix": "frz", | |
"body": [ | |
"import 'package:freezed_annotation/freezed_annotation.dart';", | |
"", | |
"part '${1/(.*)/${1:/downcase}/}.freezed.dart';", | |
"part '${1/(.*)/${1:/downcase}/}.g.dart'", | |
"", | |
"@freezed", | |
"abstract class ${1:Classname} with _$${1:Classname} {", | |
"\tfactory ${1:Classname}(classProperties) = _${1:Classname};", | |
"}" | |
], | |
"description": "Create new immutable data type" | |
}, | |
"Freezed Serializable Class": { | |
"prefix": "frzs", | |
"body": [ | |
"import 'package:freezed_annotation/freezed_annotation.dart';", | |
"", | |
"part '${1/(.*)/${1:/downcase}/}.freezed.dart';", | |
"part '${1/(.*)/${1:/downcase}/}.g.dart';", | |
"", | |
"@freezed", | |
"abstract class ${1:Classname} implements _$${1:Classname} {", | |
"\tfactory ${1:Classname}(${2:properties}) = _${1:Classname};", | |
"\tfactory ${1:Classname}.fromJson(Map<String, dynamic> json) => _$${1:Classname}FromJson(json);", | |
"}" | |
], | |
"description": "Create new immutable JSON serilizable data type" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to hit Tab after writing classname for classname to filename snippet converter to work correctly