1
1
# graphql-codegen-flutter-artemis-hooks
2
2
3
- this is graphql-codegen plugin to generate Flutter artemis hooks.
3
+ This is graphql-codegen plugin to generate type-safe, easy-to use Flutter artemis hooks.
4
+ For further detail, see "What it generates" section.
5
+
6
+ ## Prerequisite
7
+
8
+ This plugin assumes that you use the following packages
9
+
10
+ - [ flutter_hooks] ( https://pub.dev/packages/flutter_hooks )
11
+ - [ graphql_flutter] ( https://pub.dev/packages/graphql_flutter )
12
+ - [ artemis] ( https://pub.dev/packages/artemis )
4
13
5
14
## How to use
6
15
@@ -12,20 +21,20 @@ npm i graphql-codegen-flutter-artemis-hooks
12
21
13
22
### Edit codegen.yml
14
23
15
- you need to specify path for generated file by artemis
24
+ Please specify path to the file generated by artemis
16
25
17
26
``` yml
18
27
schema : your_schema_file.graphql
19
28
documents : ' ./your_project/**/*.graphql'
20
29
generates :
21
- test/output .dart :
30
+ your_project/generated_hooks .dart :
22
31
config :
23
32
artemisImportPath : package:your_project/your_artemis_generated/graphql_api.dart
24
33
plugins :
25
34
- graphql-codegen-flutter-artemis-hooks
26
35
` ` `
27
36
28
- then run the plugin !!
37
+ then run the codegens !!
29
38
30
39
## What it generates
31
40
@@ -95,7 +104,7 @@ ExampleQuery$QueryReturnType useExampleQueryQuery<DataType>(BuildContext context
95
104
return ExampleQuery$QueryReturnType(result.isLoading, result.exception, result.data == null ? null : ExampleQuery$Query.fromJson(result.data!));
96
105
}
97
106
98
- class TestMutation$MutationReturnType {
107
+ class TestMutation$MutationReturnType {
99
108
bool isLoading;
100
109
OperationException? exception;
101
110
TestMutation$Mutation? data;
@@ -109,7 +118,7 @@ TestMutation$MutationReturnType useTestMutationQuery<DataType>(BuildContext cont
109
118
}
110
119
```
111
120
112
- Then you can use the generated type-safe hooks as following
121
+ Then you can use the generated type-safe hooks as following.
113
122
114
123
``` dart
115
124
class PageWidget extends HookWidget {
@@ -125,14 +134,6 @@ class PageWidget extends HookWidget {
125
134
}
126
135
```
127
136
128
- ## Prerequisite
129
-
130
- This project is assumes you would use the following packages
131
-
132
- - [ flutter_hooks] ( https://pub.dev/packages/flutter_hooks )
133
- - [ graphql_flutter] ( https://pub.dev/packages/graphql_flutter )
134
- - [ artemis] ( https://pub.dev/packages/artemis )
135
-
136
137
## Configuration
137
138
138
139
- ` artemisImportPath ` : path to your generated file by artemis
0 commit comments