20
20
// ignore_for_file: public_member_api_docs, annotate_overrides, dead_code, dead_codepublic_member_api_docs, depend_on_referenced_packages, file_names, library_private_types_in_public_api, no_leading_underscores_for_library_prefixes, no_leading_underscores_for_local_identifiers, non_constant_identifier_names, null_check_on_nullable_type_parameter, prefer_adjacent_string_concatenation, prefer_const_constructors, prefer_if_null_operators, prefer_interpolation_to_compose_strings, slash_for_doc_comments, sort_child_properties_last, unnecessary_const, unnecessary_constructor_name, unnecessary_late, unnecessary_new, unnecessary_null_aware_assignments, unnecessary_nullable_for_final_variable_declarations, unnecessary_string_interpolations, use_build_context_synchronously
21
21
22
22
import 'ModelProvider.dart' ;
23
- import 'package:amplify_core/amplify_core.dart' ;
23
+ import 'package:amplify_core/amplify_core.dart' as amplify_core ;
24
24
import 'package:collection/collection.dart' ;
25
- import 'package:flutter/foundation.dart' ;
26
25
27
- /// This is an auto generated class representing the Blog type in your schema.
28
- @immutable
29
- class Blog extends Model {
30
- static const classType = _BlogModelType ();
26
+ /** This is an auto generated class representing the Blog type in your schema. */
27
+ class Blog extends amplify_core.Model {
28
+ static const classType = const _BlogModelType ();
31
29
final String id;
32
30
final String ? _name;
33
31
final List <Post >? _posts;
34
- final TemporalDateTime ? _createdAt;
35
- final TemporalDateTime ? _updatedAt;
32
+ final amplify_core. TemporalDateTime ? _createdAt;
33
+ final amplify_core. TemporalDateTime ? _updatedAt;
36
34
37
35
@override
38
36
getInstanceType () => classType;
@@ -50,10 +48,10 @@ class Blog extends Model {
50
48
try {
51
49
return _name! ;
52
50
} catch (e) {
53
- throw AmplifyCodeGenModelException (
54
- AmplifyExceptionMessages
51
+ throw amplify_core. AmplifyCodeGenModelException (
52
+ amplify_core. AmplifyExceptionMessages
55
53
.codeGenRequiredFieldForceCastExceptionMessage,
56
- recoverySuggestion: AmplifyExceptionMessages
54
+ recoverySuggestion: amplify_core. AmplifyExceptionMessages
57
55
.codeGenRequiredFieldForceCastRecoverySuggestion,
58
56
underlyingException: e.toString ());
59
57
}
@@ -63,11 +61,11 @@ class Blog extends Model {
63
61
return _posts;
64
62
}
65
63
66
- TemporalDateTime ? get createdAt {
64
+ amplify_core. TemporalDateTime ? get createdAt {
67
65
return _createdAt;
68
66
}
69
67
70
- TemporalDateTime ? get updatedAt {
68
+ amplify_core. TemporalDateTime ? get updatedAt {
71
69
return _updatedAt;
72
70
}
73
71
@@ -80,7 +78,7 @@ class Blog extends Model {
80
78
81
79
factory Blog ({String ? id, required String name, List <Post >? posts}) {
82
80
return Blog ._internal (
83
- id: id == null ? UUID .getUUID () : id,
81
+ id: id == null ? amplify_core. UUID .getUUID () : id,
84
82
name: name,
85
83
posts: posts != null ? List <Post >.unmodifiable (posts) : posts);
86
84
}
@@ -103,7 +101,7 @@ class Blog extends Model {
103
101
104
102
@override
105
103
String toString () {
106
- var buffer = StringBuffer ();
104
+ var buffer = new StringBuffer ();
107
105
108
106
buffer.write ("Blog {" );
109
107
buffer.write ("id=" + "$id " + ", " );
@@ -123,21 +121,29 @@ class Blog extends Model {
123
121
id: id, name: name ?? this .name, posts: posts ?? this .posts);
124
122
}
125
123
124
+ Blog copyWithModelFieldValues (
125
+ {ModelFieldValue <String >? name, ModelFieldValue <List <Post >?>? posts}) {
126
+ return Blog ._internal (
127
+ id: id,
128
+ name: name == null ? this .name : name.value,
129
+ posts: posts == null ? this .posts : posts.value);
130
+ }
131
+
126
132
Blog .fromJson (Map <String , dynamic > json)
127
133
: id = json['id' ],
128
134
_name = json['name' ],
129
135
_posts = json['posts' ] is List
130
136
? (json['posts' ] as List )
131
137
.where ((e) => e? ['serializedData' ] != null )
132
138
.map ((e) => Post .fromJson (
133
- Map <String , dynamic >.from (e['serializedData' ])))
139
+ new Map <String , dynamic >.from (e['serializedData' ])))
134
140
.toList ()
135
141
: null ,
136
142
_createdAt = json['createdAt' ] != null
137
- ? TemporalDateTime .fromString (json['createdAt' ])
143
+ ? amplify_core. TemporalDateTime .fromString (json['createdAt' ])
138
144
: null ,
139
145
_updatedAt = json['updatedAt' ] != null
140
- ? TemporalDateTime .fromString (json['updatedAt' ])
146
+ ? amplify_core. TemporalDateTime .fromString (json['updatedAt' ])
141
147
: null ;
142
148
143
149
Map <String , dynamic > toJson () => {
@@ -156,76 +162,84 @@ class Blog extends Model {
156
162
'updatedAt' : _updatedAt
157
163
};
158
164
159
- static final QueryModelIdentifier <BlogModelIdentifier > MODEL_IDENTIFIER =
160
- QueryModelIdentifier <BlogModelIdentifier >();
161
- static final QueryField ID = QueryField (fieldName: "id" );
162
- static final QueryField NAME = QueryField (fieldName: "name" );
163
- static final QueryField POSTS = QueryField (
165
+ static final amplify_core.QueryModelIdentifier <BlogModelIdentifier >
166
+ MODEL_IDENTIFIER =
167
+ amplify_core.QueryModelIdentifier <BlogModelIdentifier >();
168
+ static final ID = amplify_core.QueryField (fieldName: "id" );
169
+ static final NAME = amplify_core.QueryField (fieldName: "name" );
170
+ static final POSTS = amplify_core.QueryField (
164
171
fieldName: "posts" ,
165
- fieldType: ModelFieldType (ModelFieldTypeEnum .model, ofModelName: 'Post' ));
166
- static var schema =
167
- Model .defineSchema (define: (ModelSchemaDefinition modelSchemaDefinition) {
172
+ fieldType: amplify_core.ModelFieldType (
173
+ amplify_core.ModelFieldTypeEnum .model,
174
+ ofModelName: 'Post' ));
175
+ static var schema = amplify_core.Model .defineSchema (
176
+ define: (amplify_core.ModelSchemaDefinition modelSchemaDefinition) {
168
177
modelSchemaDefinition.name = "Blog" ;
169
178
modelSchemaDefinition.pluralName = "Blogs" ;
170
179
171
180
modelSchemaDefinition.authRules = [
172
- AuthRule (
173
- authStrategy: AuthStrategy .PUBLIC ,
174
- provider: AuthRuleProvider .APIKEY ,
175
- operations: [ ModelOperation .READ ]),
176
- AuthRule (
177
- authStrategy: AuthStrategy .PUBLIC ,
178
- provider: AuthRuleProvider .IAM ,
179
- operations: [ ModelOperation .READ ]),
180
- AuthRule (
181
- authStrategy: AuthStrategy .PRIVATE ,
182
- provider: AuthRuleProvider .IAM ,
183
- operations: [ ModelOperation .READ ]),
184
- AuthRule (
185
- authStrategy: AuthStrategy .PRIVATE ,
186
- provider: AuthRuleProvider .USERPOOLS ,
187
- operations: [ ModelOperation .READ ]),
188
- AuthRule (
189
- authStrategy: AuthStrategy .OWNER ,
181
+ amplify_core. AuthRule (
182
+ authStrategy: amplify_core. AuthStrategy .PUBLIC ,
183
+ provider: amplify_core. AuthRuleProvider .APIKEY ,
184
+ operations: const [amplify_core. ModelOperation .READ ]),
185
+ amplify_core. AuthRule (
186
+ authStrategy: amplify_core. AuthStrategy .PUBLIC ,
187
+ provider: amplify_core. AuthRuleProvider .IAM ,
188
+ operations: const [amplify_core. ModelOperation .READ ]),
189
+ amplify_core. AuthRule (
190
+ authStrategy: amplify_core. AuthStrategy .PRIVATE ,
191
+ provider: amplify_core. AuthRuleProvider .IAM ,
192
+ operations: const [amplify_core. ModelOperation .READ ]),
193
+ amplify_core. AuthRule (
194
+ authStrategy: amplify_core. AuthStrategy .PRIVATE ,
195
+ provider: amplify_core. AuthRuleProvider .USERPOOLS ,
196
+ operations: const [amplify_core. ModelOperation .READ ]),
197
+ amplify_core. AuthRule (
198
+ authStrategy: amplify_core. AuthStrategy .OWNER ,
190
199
ownerField: "owner" ,
191
200
identityClaim: "cognito:username" ,
192
- provider: AuthRuleProvider .USERPOOLS ,
193
- operations: [
194
- ModelOperation .CREATE ,
195
- ModelOperation .READ ,
196
- ModelOperation .UPDATE ,
197
- ModelOperation .DELETE
201
+ provider: amplify_core. AuthRuleProvider .USERPOOLS ,
202
+ operations: const [
203
+ amplify_core. ModelOperation .CREATE ,
204
+ amplify_core. ModelOperation .READ ,
205
+ amplify_core. ModelOperation .UPDATE ,
206
+ amplify_core. ModelOperation .DELETE
198
207
])
199
208
];
200
209
201
- modelSchemaDefinition.addField (ModelFieldDefinition .id ());
210
+ modelSchemaDefinition.addField (amplify_core. ModelFieldDefinition .id ());
202
211
203
- modelSchemaDefinition.addField (ModelFieldDefinition .field (
212
+ modelSchemaDefinition.addField (amplify_core. ModelFieldDefinition .field (
204
213
key: Blog .NAME ,
205
214
isRequired: true ,
206
- ofType: ModelFieldType (ModelFieldTypeEnum .string)));
215
+ ofType: amplify_core.ModelFieldType (
216
+ amplify_core.ModelFieldTypeEnum .string)));
207
217
208
- modelSchemaDefinition.addField (ModelFieldDefinition .hasMany (
218
+ modelSchemaDefinition.addField (amplify_core. ModelFieldDefinition .hasMany (
209
219
key: Blog .POSTS ,
210
220
isRequired: false ,
211
221
ofModelName: 'Post' ,
212
222
associatedKey: Post .BLOG ));
213
223
214
- modelSchemaDefinition.addField (ModelFieldDefinition .nonQueryField (
215
- fieldName: 'createdAt' ,
216
- isRequired: false ,
217
- isReadOnly: true ,
218
- ofType: ModelFieldType (ModelFieldTypeEnum .dateTime)));
219
-
220
- modelSchemaDefinition.addField (ModelFieldDefinition .nonQueryField (
221
- fieldName: 'updatedAt' ,
222
- isRequired: false ,
223
- isReadOnly: true ,
224
- ofType: ModelFieldType (ModelFieldTypeEnum .dateTime)));
224
+ modelSchemaDefinition.addField (
225
+ amplify_core.ModelFieldDefinition .nonQueryField (
226
+ fieldName: 'createdAt' ,
227
+ isRequired: false ,
228
+ isReadOnly: true ,
229
+ ofType: amplify_core.ModelFieldType (
230
+ amplify_core.ModelFieldTypeEnum .dateTime)));
231
+
232
+ modelSchemaDefinition.addField (
233
+ amplify_core.ModelFieldDefinition .nonQueryField (
234
+ fieldName: 'updatedAt' ,
235
+ isRequired: false ,
236
+ isReadOnly: true ,
237
+ ofType: amplify_core.ModelFieldType (
238
+ amplify_core.ModelFieldTypeEnum .dateTime)));
225
239
});
226
240
}
227
241
228
- class _BlogModelType extends ModelType <Blog > {
242
+ class _BlogModelType extends amplify_core. ModelType <Blog > {
229
243
const _BlogModelType ();
230
244
231
245
@override
@@ -239,13 +253,14 @@ class _BlogModelType extends ModelType<Blog> {
239
253
}
240
254
}
241
255
242
- /// This is an auto generated class representing the model identifier
243
- /// of [Blog] in your schema.
244
- @immutable
245
- class BlogModelIdentifier implements ModelIdentifier <Blog > {
256
+ /**
257
+ * This is an auto generated class representing the model identifier
258
+ * of [Blog] in your schema.
259
+ */
260
+ class BlogModelIdentifier implements amplify_core.ModelIdentifier <Blog > {
246
261
final String id;
247
262
248
- /// Create an instance of BlogModelIdentifier using [id] the primary key.
263
+ /** Create an instance of BlogModelIdentifier using [id] the primary key. */
249
264
const BlogModelIdentifier ({required this .id});
250
265
251
266
@override
0 commit comments