Skip to content

Commit

Permalink
Merge pull request #30 from fnicastri/main
Browse files Browse the repository at this point in the history
Removed abstract class declaration from freezed templates
  • Loading branch information
tbm98 authored Jun 19, 2021
2 parents a26c4b5 + 076e074 commit 4c6450c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup=com.github.tbm98.fluttergeneratorsnippets
pluginName=flutter_generator_snippets
pluginVersion=1.3.0
pluginVersion=1.3.1
pluginSinceBuild=201
pluginUntilBuild=211.*
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
Expand Down
21 changes: 19 additions & 2 deletions src/main/resources/liveTemplates/Flutter_generator_snippets.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<templateSet group="Flutter generator snippets">
<template name="freezed" 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">
<template name="freezed" 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;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" />
Expand All @@ -8,7 +8,24 @@
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
<template name="freezedWithoutImport" 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">
<template name="freezedWithoutImport" value="@freezed&#10;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="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" />
Expand Down

0 comments on commit 4c6450c

Please sign in to comment.