Skip to content

Commit d7d3e3a

Browse files
authored
Merge pull request #66 from flutter-news-app-full-source-code/fix_app_boot
refactor(splash): remove unused web splash code and update imports
2 parents b9c53b0 + d678345 commit d7d3e3a

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// A stub implementation of the splash remover for non-web platforms.
2+
///
3+
/// This function does nothing, as splash screen removal is only handled
4+
/// on the web.
5+
void removeSplashFromWeb() {
6+
// No-op for non-web platforms.
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'dart:js_interop';
2+
3+
/// Web-specific implementation that calls the JavaScript function
4+
/// to remove the splash screen.
5+
@JS('removeSplashFromWeb')
6+
external void removeSplashFromWeb();

lib/app/services/web_splash.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export 'splash_remover_stub.dart'
2+
if (dart.library.html) 'splash_remover_web.dart';

lib/main.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import 'dart:js_interop';
2-
31
import 'package:device_preview/device_preview.dart';
2+
import 'package:flutter_news_app_mobile_client_full_source_code/app/services/web_splash.dart';
43
import 'package:flutter/foundation.dart';
54
import 'package:flutter/material.dart';
65
import 'package:flutter_news_app_mobile_client_full_source_code/app/config/config.dart';
@@ -9,9 +8,6 @@ import 'package:flutter_news_app_mobile_client_full_source_code/bootstrap.dart';
98
// Define the current application environment (production/development/demo).
109
const appEnvironment = AppEnvironment.development;
1110

12-
@JS('removeSplashFromWeb')
13-
external void removeSplashFromWeb();
14-
1511
void main() async {
1612
final appConfig = switch (appEnvironment) {
1713
AppEnvironment.production => AppConfig.production(),

0 commit comments

Comments
 (0)