Skip to content

Update main.dart #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2025
Merged
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
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/app/config/confi
import 'package:flutter_news_app_web_dashboard_full_source_code/bootstrap.dart';

// Define the current application environment (production/development/demo).
const AppEnvironment appEnvironment = AppEnvironment.development;
const AppEnvironment appEnvironment = AppEnvironment.demo;

Choose a reason for hiding this comment

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

critical

Hardcoding the application environment is prone to errors, as it can lead to accidentally committing a development or demo configuration that gets deployed to production. A better practice is to use compile-time variables to configure the environment, which allows you to build the app for any environment without changing the code.

You can achieve this using String.fromEnvironment and pass the value during the build command, for example: flutter build web --dart-define=APP_ENVIRONMENT=production.

const appEnvironment = AppEnvironment.values.byName(
  String.fromEnvironment('APP_ENVIRONMENT', defaultValue: 'development'),
);


@JS('removeSplashFromWeb')
external void removeSplashFromWeb();
Expand Down
Loading