Add production base URL for API#8
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
| if (isProd) { | ||
| return 'https://gdg-appointment-booking-system.onrender.com/api'; | ||
| } |
There was a problem hiding this comment.
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.
| 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.
Summary by CodeRabbit