Skip to content

Add production base URL for API#8

Closed
lelisa21 wants to merge 1 commit into
mainfrom
lelisa21-patch-1
Closed

Add production base URL for API#8
lelisa21 wants to merge 1 commit into
mainfrom
lelisa21-patch-1

Conversation

@lelisa21
Copy link
Copy Markdown

@lelisa21 lelisa21 commented Apr 7, 2026

Summary by CodeRabbit

  • Chores
    • Updated API endpoint configuration to properly route requests to the production server when in production mode.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

The baseUrl property in the environment configuration now prioritizes production API endpoint selection. When isProd is enabled, it returns the production URL before evaluating platform-specific conditions like kIsWeb or device type.

Changes

Cohort / File(s) Summary
Environment Configuration
lib/core/config/env.dart
Updated baseUrl getter to conditionally return production API endpoint (https://gdg-appointment-booking-system.onrender.com/api) when isProd is true, short-circuiting existing web and platform-based URL logic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 The config now knows, when prod flags rise,
To skip the platform dance and bypass disguise,
One URL shines: the render endpoint true,
Production awaits—no more, just zoom! 🚀

🚥 Pre-merge checks | ✅ 3
✅ 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 'Add production base URL for API' accurately describes the main change: adding a production API endpoint to the baseUrl property in env.dart.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lelisa21-patch-1

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/core/config/env.dart`:
- Around line 7-9: The code references an undefined isProd variable in the
env.dart conditional; replace that with Flutter's kReleaseMode (already imported
from foundation.dart) in the if (isProd) check so the block becomes if
(kReleaseMode) { ... } OR, if you need runtime control, declare isProd using a
compile-time flag (e.g., const bool.fromEnvironment('PROD', defaultValue:
false)) and use that variable in the same conditional, documenting that
production builds must pass --dart-define=PROD=true; update the conditional
referencing isProd accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bdceb0fd-e6af-4da0-85a7-9fd38c1f2b2b

📥 Commits

Reviewing files that changed from the base of the PR and between d301425 and 91d473c.

📒 Files selected for processing (1)
  • lib/core/config/env.dart

Comment thread lib/core/config/env.dart
Comment on lines +7 to +9
if (isProd) {
return 'https://gdg-appointment-booking-system.onrender.com/api';
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

isProd is undefined — build fails.

The pipeline confirms this: Undefined name 'isProd'. The variable is referenced but never declared or imported.

If you intend to switch based on Flutter's build mode, use kReleaseMode (already available from the imported foundation.dart). Alternatively, define isProd explicitly using compile-time environment variables.

🐛 Option 1: Use kReleaseMode (simplest)
 static String get baseUrl {
-    if (isProd) {
+    if (kReleaseMode) {
       return 'https://gdg-appointment-booking-system.onrender.com/api';
     }
🐛 Option 2: Define isProd via compile-time environment variable
 class Env {
   Env._();
 
+  static const bool isProd = bool.fromEnvironment('PROD', defaultValue: false);
+
   static String get baseUrl {
     if (isProd) {

Then pass --dart-define=PROD=true when building for production.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (isProd) {
return 'https://gdg-appointment-booking-system.onrender.com/api';
}
if (kReleaseMode) {
return 'https://gdg-appointment-booking-system.onrender.com/api';
}
🧰 Tools
🪛 GitHub Actions: Flutter CI

[error] 7-7: flutter analyze failed: Undefined name 'isProd'. (undefined_identifier)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/core/config/env.dart` around lines 7 - 9, The code references an
undefined isProd variable in the env.dart conditional; replace that with
Flutter's kReleaseMode (already imported from foundation.dart) in the if
(isProd) check so the block becomes if (kReleaseMode) { ... } OR, if you need
runtime control, declare isProd using a compile-time flag (e.g., const
bool.fromEnvironment('PROD', defaultValue: false)) and use that variable in the
same conditional, documenting that production builds must pass
--dart-define=PROD=true; update the conditional referencing isProd accordingly.

@lelisa21 lelisa21 closed this Apr 7, 2026
@lelisa21 lelisa21 deleted the lelisa21-patch-1 branch April 7, 2026 04:13
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.

1 participant