Skip to content

refactor(splash): remove unused web splash code and update imports #66

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
Jul 29, 2025
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions lib/app/services/splash_remover_stub.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// A stub implementation of the splash remover for non-web platforms.
///
/// This function does nothing, as splash screen removal is only handled
/// on the web.
void removeSplashFromWeb() {
// No-op for non-web platforms.
}
6 changes: 6 additions & 0 deletions lib/app/services/splash_remover_web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'dart:js_interop';

/// Web-specific implementation that calls the JavaScript function
/// to remove the splash screen.
@JS('removeSplashFromWeb')
external void removeSplashFromWeb();
2 changes: 2 additions & 0 deletions lib/app/services/web_splash.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'splash_remover_stub.dart'
if (dart.library.html) 'splash_remover_web.dart';
6 changes: 1 addition & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:js_interop';

import 'package:device_preview/device_preview.dart';
import 'package:flutter_news_app_mobile_client_full_source_code/app/services/web_splash.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_news_app_mobile_client_full_source_code/app/config/config.dart';
Expand All @@ -9,9 +8,6 @@ import 'package:flutter_news_app_mobile_client_full_source_code/bootstrap.dart';
// Define the current application environment (production/development/demo).
const appEnvironment = AppEnvironment.development;

@JS('removeSplashFromWeb')
external void removeSplashFromWeb();

void main() async {
final appConfig = switch (appEnvironment) {
AppEnvironment.production => AppConfig.production(),
Expand Down
Loading