@@ -3355,6 +3355,105 @@ class _authorBookModelType extends ModelType<authorBook> {
3355
3355
"
3356
3356
`;
3357
3357
3358
+ exports[`AppSync Dart Visitor Null Safety Tests should generate correct internal constructor for a model has only ID field 1`] = `
3359
+ "/*
3360
+ * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3361
+ *
3362
+ * Licensed under the Apache License, Version 2.0 (the \\"License\\").
3363
+ * You may not use this file except in compliance with the License.
3364
+ * A copy of the License is located at
3365
+ *
3366
+ * http://aws.amazon.com/apache2.0
3367
+ *
3368
+ * or in the \\"license\\" file accompanying this file. This file is distributed
3369
+ * on an \\"AS IS\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
3370
+ * express or implied. See the License for the specific language governing
3371
+ * permissions and limitations under the License.
3372
+ */
3373
+
3374
+ // ignore_for_file: public_member_api_docs
3375
+
3376
+ import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart';
3377
+ import 'package:flutter/foundation.dart';
3378
+
3379
+
3380
+ /** This is an auto generated class representing the TestModel type in your schema. */
3381
+ @immutable
3382
+ class TestModel extends Model {
3383
+ static const classType = const _TestModelModelType();
3384
+ final String id;
3385
+
3386
+ @override
3387
+ getInstanceType() => classType;
3388
+
3389
+ @override
3390
+ String getId() {
3391
+ return id;
3392
+ }
3393
+
3394
+ const TestModel._internal({required this.id});
3395
+
3396
+ factory TestModel({String? id}) {
3397
+ return TestModel._internal(
3398
+ id: id == null ? UUID.getUUID() : id);
3399
+ }
3400
+
3401
+ bool equals(Object other) {
3402
+ return this == other;
3403
+ }
3404
+
3405
+ @override
3406
+ bool operator ==(Object other) {
3407
+ if (identical(other, this)) return true;
3408
+ return other is TestModel &&
3409
+ id == other.id;
3410
+ }
3411
+
3412
+ @override
3413
+ int get hashCode => toString().hashCode;
3414
+
3415
+ @override
3416
+ String toString() {
3417
+ var buffer = new StringBuffer();
3418
+
3419
+ buffer.write(\\"TestModel {\\");
3420
+ buffer.write(\\"id=\\" + \\"$id\\");
3421
+ buffer.write(\\"}\\");
3422
+
3423
+ return buffer.toString();
3424
+ }
3425
+
3426
+ TestModel copyWith({String? id}) {
3427
+ return TestModel(
3428
+ id: id ?? this.id);
3429
+ }
3430
+
3431
+ TestModel.fromJson(Map<String, dynamic> json)
3432
+ : id = json['id'];
3433
+
3434
+ Map<String, dynamic> toJson() => {
3435
+ 'id': id
3436
+ };
3437
+
3438
+ static final QueryField ID = QueryField(fieldName: \\"testModel.id\\");
3439
+ static var schema = Model.defineSchema(define: (ModelSchemaDefinition modelSchemaDefinition) {
3440
+ modelSchemaDefinition.name = \\"TestModel\\";
3441
+ modelSchemaDefinition.pluralName = \\"TestModels\\";
3442
+
3443
+ modelSchemaDefinition.addField(ModelFieldDefinition.id());
3444
+ });
3445
+ }
3446
+
3447
+ class _TestModelModelType extends ModelType<TestModel> {
3448
+ const _TestModelModelType();
3449
+
3450
+ @override
3451
+ TestModel fromJson(Map<String, dynamic> jsonData) {
3452
+ return TestModel.fromJson(jsonData);
3453
+ }
3454
+ }"
3455
+ `;
3456
+
3358
3457
exports[`AppSync Dart Visitor Null Safety Tests should generate correct model files if the null safety is enabled 1`] = `
3359
3458
"/*
3360
3459
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
0 commit comments