Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unnecessary_non_null_assertion for updatedAt and createdAt in toString() from dart generator #839

Open
4 tasks done
koromkorom opened this issue May 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@koromkorom
Copy link

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

How did you install the Amplify CLI?

curl

If applicable, what version of Node.js are you using?

v18.20.2

Amplify CLI Version

12.12.0

What operating system are you using?

Mac

Amplify Codegen Command

codegen models

Describe the bug

Generation of default DateTime fields for flutter creates unnecessary_non_null_assertion warning in toString() method for the exclamation marks:

    buffer.write("createdAt=" + (_createdAt != null ? _createdAt!.format() : "null") + ", ");
    buffer.write("updatedAt=" + (_updatedAt != null ? _updatedAt!.format() : "null"));

Expected behavior

No such warnings.

Reproduction steps

  1. Create any schema field in Amplify Studio
  2. amplify pull in flutter project
  3. amplify codegen models

GraphQL schema(s)

# Put schemas below this line
type Message @model @auth(rules: [{allow: public}]) {
  id: ID!
  text: String
}

Log output

# Put your logs below this line
The '!' will have no effect because the receiver can't be null.
Try removing the '!' operator.

Additional information

No response

@dpilch dpilch added the bug Something isn't working label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants