Skip to content

Commit

Permalink
add part & remove @JsonSerializable
Browse files Browse the repository at this point in the history
  • Loading branch information
tbm98 committed Feb 17, 2023
1 parent b2fd579 commit abc0c2f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Plugin Changelog

## [Unreleased]
- Add part
- Remove @JsonSerializable

## [2.223.0]
- Support 2022.3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ freezed
![json-inside](demo/freezed.png)
## Requirements

IntelliJ based: since-build: 202 [learn more](https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html)
IntelliJ based: since-build: 203 [learn more](https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html)


## Installation
Expand Down
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=2.223.0
pluginVersion=2.223.1


# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
Expand Down
10 changes: 8 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;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; 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,7 @@
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
<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">
<template name="freezedWithoutImport" value="@freezed&#10;class $ClassName$ with _$$$ClassName$ {&#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 Expand Up @@ -56,4 +56,10 @@
<option name="DART_TOPLEVEL" value="false" />
</context>
</template>
<template name="part" value="part '$fileName$.freezed.dart';&#10;part '$fileName$.g.dart';" description="Declare part for .g.dart and .freezed.dart" toReformat="true" toShortenFQNames="true">
<variable name="fileName" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
</templateSet>

0 comments on commit abc0c2f

Please sign in to comment.