|
| 1 | +{ |
| 2 | +// Place your aha-dart workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and |
| 3 | +// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope |
| 4 | +// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is |
| 5 | +// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: |
| 6 | +// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. |
| 7 | +// Placeholders with the same ids are connected. |
| 8 | +// Example: |
| 9 | +// "Print to console": { |
| 10 | +// "scope": "javascript,typescript", |
| 11 | +// "prefix": "log", |
| 12 | +// "body": [ |
| 13 | +// "console.log('$1');", |
| 14 | +// "$2" |
| 15 | +// ], |
| 16 | +// "description": "Log output to console" |
| 17 | +// } |
| 18 | +"Create XML serializable with root element": { |
| 19 | +"scope": "dart", |
| 20 | +"prefix": [ |
| 21 | +"xml-root", |
| 22 | +"xml-serializable-root" |
| 23 | +], |
| 24 | +"body": [ |
| 25 | +"import 'package:meta/meta.dart';", |
| 26 | +"import 'package:xml/xml.dart';", |
| 27 | +"import 'package:xml_annotation/xml_annotation.dart' as xml;", |
| 28 | +"", |
| 29 | +"part '$TM_FILENAME_BASE.g.dart';", |
| 30 | +"", |
| 31 | +"const ${1/(.)(.*)/${1:/downcase}$2/}ElementName = '$2';", |
| 32 | +"", |
| 33 | +"@xml.XmlSerializable(createMixin: true)", |
| 34 | +"@xml.XmlRootElement(name: ${1/(.)(.*)/${1:/downcase}$2/}ElementName)", |
| 35 | +"@immutable", |
| 36 | +"class ${1/(.)(.*)/${1:/upcase}$2/} extends XmlConvertible<${1/(.)(.*)/${1:/upcase}$2/}>", |
| 37 | +" with _$${1/(.)(.*)/${1:/upcase}$2/}XmlSerializableMixin, _${1/(.)(.*)/${1:/upcase}$2/}Equality {", |
| 38 | +"", |
| 39 | +"const ${1/(.)(.*)/${1:/upcase}$2/}();", |
| 40 | +"", |
| 41 | +"factory ${1/(.)(.*)/${1:/upcase}$2/}.fromXmlElement(XmlElement element) =>", |
| 42 | +" _$${1/(.)(.*)/${1:/upcase}$2/}FromXmlElement(element);", |
| 43 | +"}", |
| 44 | +"", |
| 45 | +"mixin _${1/(.)(.*)/${1:/upcase}$2/}Equality on XmlConvertible$0<${1/(.)(.*)/${1:/upcase}$2/}> {", |
| 46 | +" @override", |
| 47 | +" List<Object?> get props => [];", |
| 48 | +"}" |
| 49 | +], |
| 50 | +"description": "Creates a XML serializable and convertible class", |
| 51 | +}, |
| 52 | +"Create XML serializable": { |
| 53 | +"scope": "dart", |
| 54 | +"prefix": [ |
| 55 | +"xml", |
| 56 | +"xml-serializable" |
| 57 | +], |
| 58 | +"body": [ |
| 59 | +"import 'package:meta/meta.dart';", |
| 60 | +"import 'package:xml/xml.dart';", |
| 61 | +"import 'package:xml_annotation/xml_annotation.dart' as xml;", |
| 62 | +"", |
| 63 | +"part '$TM_FILENAME_BASE.g.dart';", |
| 64 | +"", |
| 65 | +"@xml.XmlSerializable(createMixin: true)", |
| 66 | +"@immutable", |
| 67 | +"class ${1/(.)(.*)/${1:/upcase}$2/} extends XmlEquatable<${1/(.)(.*)/${1:/upcase}$2/}>", |
| 68 | +" with _$${1/(.)(.*)/${1:/upcase}$2/}XmlSerializableMixin, _${1/(.)(.*)/${1:/upcase}$2/}Equality {", |
| 69 | +"", |
| 70 | +"const ${1/(.)(.*)/${1:/upcase}$2/}();", |
| 71 | +"", |
| 72 | +"factory ${1/(.)(.*)/${1:/upcase}$2/}.fromXmlElement(XmlElement element) =>", |
| 73 | +" _$${1/(.)(.*)/${1:/upcase}$2/}FromXmlElement(element);", |
| 74 | +"}", |
| 75 | +"", |
| 76 | +"mixin _${1/(.)(.*)/${1:/upcase}$2/}Equality on XmlEquatable$0<${1/(.)(.*)/${1:/upcase}$2/}> {", |
| 77 | +" @override", |
| 78 | +" List<Object?> get props => [];", |
| 79 | +"}" |
| 80 | +], |
| 81 | +"description": "Creates a XML serializable and equatable class", |
| 82 | +} |
| 83 | +} |
0 commit comments