Skip to content

Commit

Permalink
feat(examples): starwars hivestore usage
Browse files Browse the repository at this point in the history
  • Loading branch information
micimize committed Jul 23, 2020
1 parent 2d1a7f2 commit 2f874ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions examples/starwars/lib/client_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ String uuidFromObject(Object object) {
return null;
}

final GraphQLCache cache = GraphQLCache();

ValueNotifier<GraphQLClient> clientFor({
@required String uri,
String subscriptionUri,
Expand All @@ -29,7 +27,7 @@ ValueNotifier<GraphQLClient> clientFor({

return ValueNotifier<GraphQLClient>(
GraphQLClient(
cache: cache,
cache: GraphQLCache(store: HiveStore()),
link: link,
),
);
Expand Down
6 changes: 5 additions & 1 deletion examples/starwars/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:universal_platform/universal_platform.dart';

import './client_provider.dart';
Expand All @@ -18,7 +19,10 @@ String get host {
final graphqlEndpoint = 'http://$host:3000/graphql';
final subscriptionEndpoint = 'ws://$host:3000/subscriptions';

void main() => runApp(MyApp());
void main() async {
await initHiveForFlutter();
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Expand Down
6 changes: 2 additions & 4 deletions examples/starwars/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ dependencies:
path: ../../packages/graphql_flutter
graphql:
path: ../../packages/graphql
universal_platform: ^0.1.3
universal_platform:
^0.1.3
# https://github.com/flutter/flutter/issues/36126#issuecomment-596215587
graphql_starwars_test_server: ^0.1.0

flutter:
uses-material-design: true



dependency_overrides:
graphql_server:
git:
Expand All @@ -27,4 +26,3 @@ dependency_overrides:
git:
url: [email protected]:micimize/angel.git
path: packages/graphql/graphql_parser

0 comments on commit 2f874ec

Please sign in to comment.