Skip to content

Commit

Permalink
📑 added web support
Browse files Browse the repository at this point in the history
  • Loading branch information
shashiben committed Aug 14, 2020
1 parent 229ee24 commit 232934d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 48 deletions.
17 changes: 12 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ import 'package:flutter_cache_with_hive/ui/home.dart';
import 'package:flutter_cache_with_hive/utils/appTheme.dart';
import 'package:flutter_cache_with_hive/utils/locator.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:path_provider/path_provider.dart' as path_provider;

void main() async{
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final appDirectory=await path_provider.getApplicationDocumentsDirectory();
Hive.init(appDirectory.path);
if (kIsWeb) {
await Hive.initFlutter();
} else {
final appDirectory = await path_provider.getApplicationDocumentsDirectory();
Hive.init(appDirectory.path);
}
Hive.registerAdapter(AnimeAdapter());

setupLocator();
runApp(MyApp());
}
Expand All @@ -22,7 +29,7 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
title: "Anime",
theme: themeData(context),
home: Home(),
home: Home(),
);
}
}
}
73 changes: 33 additions & 40 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.39.8"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
Expand All @@ -35,9 +28,9 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
version: "2.4.2"
auto_route:
dependency: "direct main"
dependency: transitive
description:
name: auto_route
url: "https://pub.dartlang.org"
Expand Down Expand Up @@ -113,6 +106,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "7.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.2"
charcode:
dependency: transitive
description:
Expand All @@ -127,6 +127,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
code_builder:
dependency: transitive
description:
Expand All @@ -140,7 +147,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
version: "1.15.0-nullsafety.2"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -176,6 +183,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.6"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
fixnum:
dependency: transitive
description:
Expand Down Expand Up @@ -241,7 +255,7 @@ packages:
name: hive_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0+2"
version: "0.3.1"
hive_generator:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -277,13 +291,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
injectable:
dependency: "direct main"
description:
Expand Down Expand Up @@ -332,14 +339,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.6"
version: "0.12.9"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -388,7 +395,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
path_provider:
dependency: "direct main"
description:
Expand Down Expand Up @@ -417,13 +424,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -512,7 +512,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.9.5"
stacked:
dependency: "direct main"
description:
Expand Down Expand Up @@ -561,7 +561,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.18"
timing:
dependency: transitive
description:
Expand All @@ -575,14 +575,14 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.3.0-nullsafety.2"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
watcher:
dependency: transitive
description:
Expand All @@ -597,13 +597,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
yaml:
dependency: transitive
description:
Expand All @@ -612,5 +605,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.7.0 <3.0.0"
dart: ">=2.10.0-0.0.dev <2.10.0"
flutter: ">=1.17.0 <2.0.0"
3 changes: 0 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ dependencies:
stacked: ^1.4.3
# third party usable services
stacked_services: ^0.2.2
# navigation
auto_route:
# inversion of control
get_it:
injectable:

Expand Down
10 changes: 10 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script defer src="main.dart.js" type="application/javascript"></script>
</head>
<body>
</body>
</html>

0 comments on commit 232934d

Please sign in to comment.