aws-samples / aws-samples/amplify-trips-planner

Running 'amplify codegen models' causes error

Open
#6 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
11
Forks
5
PR merge metrics
No merged PRs in 30d

Description

For context

```
$ amplify --version
12.7.1
```

```
$ flutter --version
Flutter 3.13.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d211f42860 (7 days ago) • 2023-10-25 13:42:25 -0700
Engine • revision 0545f8705d
Tools • Dart 3.1.5 • DevTools 2.25.0
```

```
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.4.1 22F770820d darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.83.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
```

In [Step Two of Module Three: Add the Activity feature ](https://aws.amazon.com/getting-started/hands-on/build-flutter-mobile-app-part-two/module-three/) the instructions say to run `amplify codeine models` which causes an error in `lib/features/trip/service/trips_api_service.dart`. The error is

```
The method 'TripModelIdentifier' isn't defined for the type 'TripsAPIService'.
Try correcting the name to the name of an existing method, or defining a method named 'TripModelIdentifier'.dart[undefined_method](https://dart.dev/diagnostics/undefined_method)
```

Because the `amplify codegen models` command changes the `lib/models/Trip.dart` file considerably, but most notable is the removal of

https://github.com/aws-samples/amplify-trips-planner/blob/51e5b013727e4a6b7ffb004b4812648722355c0a/lib/models/Trip.dart#L46-L50

and

https://github.com/aws-samples/amplify-trips-planner/blob/51e5b013727e4a6b7ffb004b4812648722355c0a/lib/models/Trip.dart#L327-L364

and I think

https://github.com/aws-samples/amplify-trips-planner/blob/51e5b013727e4a6b7ffb004b4812648722355c0a/lib/models/Trip.dart#L229

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.