Skip to content

Conversation

ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Oct 4, 2025

Summary

  • Replaced string concatenation using + operator with string interpolation
  • Resolves prefer_interpolation_to_compose_strings lint warnings
  • Applied to both Flutter and Dart templates

Why This Change is Needed

According to the Dart Linter Rules:

DO use interpolation to compose strings and values.

Using interpolation when composing strings and values is usually easier to read and less error-prone than concatenation.

String interpolation ("$variable" or "${expression}") is preferred over concatenation ("text" + variable) in Dart.

Changes Made

  1. Path concatenation: path + '/' + params[idParamName]'$path/${params[idParamName]}'
  2. Callback URL scheme: "prefix-" + config['project']!"prefix-${config['project']!}"

Files Changed

  • templates/flutter/lib/src/client_browser.dart.twig
  • templates/flutter/lib/src/client_io.dart.twig
  • templates/dart/lib/src/client_browser.dart.twig
  • templates/dart/lib/src/client_io.dart.twig

Impact

This is a non-breaking change that improves code quality by:

  • Eliminating prefer_interpolation_to_compose_strings lint warnings
  • Making the code more idiomatic and easier to read
  • Following Dart best practices

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Standardized string interpolation for building URL paths across Dart and Flutter clients (browser and IO), replacing manual concatenation.
    • Unified construction of callback URL schemes using interpolation for greater consistency.
    • No changes to behavior, APIs, or error handling; improvements are internal for readability and maintainability.

…plates

Replaced string concatenation using + operator with string interpolation to follow Dart best practices and resolve prefer_interpolation_to_compose_strings lint warnings.

Changes:
- path + '/' + params[idParamName] → '$path/${params[idParamName]}'
- "prefix-" + config['project']! → "prefix-${config['project']!}"

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

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Walkthrough

This change standardizes string construction using Dart string interpolation across four templates: templates/dart/lib/src/client_browser.dart.twig, templates/dart/lib/src/client_io.dart.twig, templates/flutter/lib/src/client_browser.dart.twig, and templates/flutter/lib/src/client_io.dart.twig. Path assembly for GET requests is updated from concatenation (e.g., path + '/' + params[idParamName]) to interpolation (e.g., '$path/${params[idParamName]}'). In the Flutter templates, the callback URL scheme is also updated to use interpolation (e.g., '{{spec.title | caseLower}}-callback-${config['project']!}'). There are no changes to control flow, error handling, or public/exported API signatures.

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 succinctly captures the main change of replacing string concatenation with interpolation in both Dart and Flutter code, clearly reflecting the core purpose of the PR without unnecessary detail.
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-string-interpolation

📜 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 722b3a1.

📒 Files selected for processing (4)
  • templates/dart/lib/src/client_browser.dart.twig (1 hunks)
  • templates/dart/lib/src/client_io.dart.twig (1 hunks)
  • templates/flutter/lib/src/client_browser.dart.twig (2 hunks)
  • templates/flutter/lib/src/client_io.dart.twig (2 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). (20)
  • GitHub Check: build (8.3, Swift56)
  • GitHub Check: build (8.3, AppleSwift56)
  • GitHub Check: build (8.3, Python310)
  • GitHub Check: build (8.3, Python313)
  • GitHub Check: build (8.3, Python311)
  • GitHub Check: build (8.3, PHP83)
  • GitHub Check: build (8.3, KotlinJava17)
  • GitHub Check: build (8.3, FlutterBeta)
  • GitHub Check: build (8.3, Node20)
  • GitHub Check: build (8.3, Node16)
  • GitHub Check: build (8.3, FlutterStable)
  • GitHub Check: build (8.3, Go118)
  • GitHub Check: build (8.3, KotlinJava8)
  • GitHub Check: build (8.3, KotlinJava11)
  • GitHub Check: build (8.3, CLINode18)
  • GitHub Check: build (8.3, Android5Java17)
  • GitHub Check: build (8.3, Android14Java17)
  • GitHub Check: swift (server)
  • GitHub Check: android (client)
  • GitHub Check: apple (client)
🔇 Additional comments (6)
templates/dart/lib/src/client_io.dart.twig (1)

146-146: LGTM! String interpolation correctly applied.

The path construction now uses Dart string interpolation ('$path/${params[idParamName]}') instead of concatenation, which aligns with the prefer_interpolation_to_compose_strings lint rule and improves readability.

templates/dart/lib/src/client_browser.dart.twig (1)

125-125: LGTM! Consistent interpolation applied.

The path construction correctly uses string interpolation, matching the pattern applied in the other templates.

templates/flutter/lib/src/client_browser.dart.twig (2)

153-153: LGTM! Path interpolation correctly applied.

The GET request path construction now uses string interpolation, consistent with the changes in other templates.


246-246: LGTM! Callback URL interpolation correctly applied.

The callback URL scheme construction now uses string interpolation ("{{spec.title | caseLower}}-callback-${config['project']!}"), which is cleaner and follows Dart best practices. The null assertion operator (!) is appropriate here as the project configuration should be set before web authentication is initiated.

templates/flutter/lib/src/client_io.dart.twig (2)

275-275: LGTM! Path interpolation correctly applied.

The GET request path construction uses string interpolation, matching the pattern consistently applied across all template files in this PR.


336-336: LGTM! Callback URL interpolation correctly applied.

The callback URL scheme construction now uses string interpolation within the conditional expression. The change maintains the existing logic while improving code readability and following Dart linting recommendations.


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 9c9865c into master Oct 6, 2025
52 checks passed
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