Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/core/config/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ class Env {
Env._();

static String get baseUrl {
if (isProd) {
return 'https://gdg-appointment-booking-system.onrender.com/api';
}
Comment on lines +7 to +9
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.

if (kIsWeb) {
return 'http://localhost:3000';
}
Expand Down
Loading