Skip to content

Commit

Permalink
Add non Abstract templates
Browse files Browse the repository at this point in the history
  • Loading branch information
fnicastri committed Jun 19, 2021
1 parent e0ec12d commit 076e074
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/resources/liveTemplates/Flutter_generator_snippets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
<template name="freezedAbstract" value="import 'package:flutter/foundation.dart';&#10;import 'package:freezed_annotation/freezed_annotation.dart';&#10;&#10;part '$fileName$.freezed.dart';&#10;part '$fileName$.g.dart';&#10;&#10;@freezed&#10;abstract class $ClassName$ with _$$$ClassName$ {&#10; @JsonSerializable(fieldRename: FieldRename.snake, explicitToJson: true)&#10; const factory $ClassName$({&#10; $Params$,&#10; }) = _$ClassName$;&#10; &#10; $code$&#10;&#10; factory $ClassName$.fromJson(Map&lt;String, dynamic&gt; json) =&gt;&#10; _$$$ClassName$FromJson(json);&#10;}" description="Create feezed template" toReformat="false" toShortenFQNames="true">
<variable name="fileName" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="true" />
<variable name="ClassName" expression="dartClassName()" defaultValue="" alwaysStopAt="true" />
<variable name="Params" expression="dartSuggestVariableName()" defaultValue="" alwaysStopAt="true" />
<variable name="code" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
<template name="freezedAbstractWithoutImport" value="@freezed&#10;abstract class $ClassName$ with _$$$ClassName$ {&#10; @JsonSerializable(fieldRename: FieldRename.snake, explicitToJson: true)&#10; const factory $ClassName$({&#10; $Params$,&#10; }) = _$ClassName$;&#10; &#10; $code$&#10;&#10; factory $ClassName$.fromJson(Map&lt;String, dynamic&gt; json) =&gt;&#10; _$$$ClassName$FromJson(json);&#10;}" description="Create freezed template without import" toReformat="false" toShortenFQNames="true">
<variable name="ClassName" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="Params" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="code" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
<template name="jsonSerializable" value="import 'package:json_annotation/json_annotation.dart';&#10;&#10;part '$file_name$.g.dart';&#10;&#10;@JsonSerializable(fieldRename: FieldRename.snake, explicitToJson: true)&#10;class $class_name$ {&#10; $class_name$();&#10; &#10; $code$&#10; &#10; factory $class_name$.fromJson(Map&lt;String, dynamic&gt; json) {&#10; return _$$$class_name$FromJson(json);&#10; }&#10;&#10; Map&lt;String, dynamic&gt; toJson() =&gt; _$$$class_name$ToJson(this);&#10;}" description="Create JsonSerializable template" toReformat="false" toShortenFQNames="true">
<variable name="file_name" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="true" />
<variable name="class_name" expression="" defaultValue="" alwaysStopAt="true" />
Expand Down

0 comments on commit 076e074

Please sign in to comment.