From 68a362bd4dbcd12cea2778f2c0a8caeaa30cc396 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Mon, 17 Jun 2024 20:07:01 +0200 Subject: [PATCH] feat(dev): limited web support for dev chore: update web 3.22. --- DEV.md | 10 ++++++++ lib/main.dart | 5 +++- web/index.html | 64 +------------------------------------------------- 3 files changed, 15 insertions(+), 64 deletions(-) diff --git a/DEV.md b/DEV.md index 5fba48f..edad2b5 100644 --- a/DEV.md +++ b/DEV.md @@ -111,3 +111,13 @@ flutter drive \ --target=integration_test/app_test.dart \ -d emu ``` + +## Run chrome device + +Starts the app on chrome on a fixed port: + + +``` +flutter run -d chrome --web-port=$DEF_PORT --web-browser-flag "--disable-web-security" +``` + diff --git a/lib/main.dart b/lib/main.dart index 22a224e..429ec96 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart' show kIsWeb; import 'package:camera/camera.dart'; import 'package:chemobile/app.dart'; import 'package:flutter/material.dart'; @@ -12,7 +13,9 @@ void main() async { cameras = await availableCameras(); final storage = await HydratedStorage.build( - storageDirectory: await getApplicationDocumentsDirectory(), + storageDirectory: kIsWeb + ? HydratedStorage.webStorageDirectory + : await getApplicationDocumentsDirectory(), ); HydratedBloc.storage = storage; diff --git a/web/index.html b/web/index.html index bafb241..c7c2ced 100644 --- a/web/index.html +++ b/web/index.html @@ -36,69 +36,7 @@ - - if ('serviceWorker' in navigator) { - // Service workers are supported. Use them. - window.addEventListener('load', function () { - // Wait for registration to finish before dropping the