Skip to content

Conversation

ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Oct 4, 2025

Summary

  • Added @override annotation to the toMap() method in the Dart model template
  • Resolves all 74+ annotate_overrides lint warnings in generated Flutter SDK models

Why This Change is Needed

According to the Dart Linter Rules:

DO annotate overridden members.

This practice improves code readability and helps avoid unintentionally overriding members.

The toMap() method overrides the abstract method defined in the Model interface, so it should be annotated with @override to follow Dart best practices.

Files Changed

  • templates/dart/lib/src/models/model.dart.twig

Impact

This is a non-breaking change that adds the @override annotation to all generated model classes. This change:

  • Eliminates 74+ annotate_overrides lint warnings
  • Improves code quality and maintainability
  • Makes the inheritance relationship explicit
  • Helps catch errors if the parent interface signature changes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style
    • Standardized override annotations in generated model methods to align with Dart conventions, improving code clarity and IDE tooling support.
    • No changes to functionality or behavior; existing features continue to work as before.
    • This update enhances maintainability and consistency across generated code without impacting performance or user workflows.

Added @OverRide annotation to the toMap() method in model template to properly indicate that it overrides the Model interface method, resolving the annotate_overrides lint warning.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Walkthrough

  • Updated templates/dart/lib/src/models/model.dart.twig to add an @OverRide annotation to the toMap() method in the generated Dart model class.
  • The toMap() method signature and behavior remain unchanged; no control flow or error handling changes were introduced.
  • No alterations to exported or public entity declarations.

Possibly related PRs

Suggested reviewers

  • abnegate

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly summarizes the main change by stating the addition of an @OverRide annotation to the toMap method in Dart models, directly reflecting the modifications in the PR.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-flutter-override-annotation-tomap

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c30701f and 16c629e.

📒 Files selected for processing (1)
  • templates/dart/lib/src/models/model.dart.twig (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: dotnet (server)
  • GitHub Check: kotlin (server)
  • GitHub Check: swift (server)
  • GitHub Check: go (server)
  • GitHub Check: apple (client)
  • GitHub Check: flutter (client)
  • GitHub Check: build (8.3, Swift56)
  • GitHub Check: build (8.3, Python312)
  • GitHub Check: build (8.3, Node18)
  • GitHub Check: build (8.3, Python310)
  • GitHub Check: build (8.3, WebChromium)
  • GitHub Check: build (8.3, Node16)
  • GitHub Check: build (8.3, Go112)
  • GitHub Check: build (8.3, Android14Java17)
  • GitHub Check: build (8.3, Android5Java17)
🔇 Additional comments (1)
templates/dart/lib/src/models/model.dart.twig (1)

62-62: LGTM! Proper use of @override annotation.

Adding @override to the toMap() method correctly addresses the annotate_overrides lint rule and makes the inheritance contract explicit. This is a non-breaking improvement that enhances code clarity and helps catch signature mismatches at compile time.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@abnegate abnegate merged commit 10e7d6c into master Oct 6, 2025
52 checks passed
@abnegate abnegate deleted the fix-flutter-override-annotation-tomap branch October 6, 2025 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants