Skip to content

Commit

Permalink
testing only, do not merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Equartey committed Jul 30, 2024
1 parent 18b33a4 commit c8b12e9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 46 deletions.
16 changes: 9 additions & 7 deletions packages/amplify_datastore/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ library sample_app;

import 'dart:async';

import 'package:amplify_datastore/amplify_datastore.dart';
// Uncomment the below line to enable online sync
// import 'package:amplify_api/amplify_api.dart';

import 'package:amplify_api/amplify_api.dart';
import 'package:amplify_datastore/amplify_datastore.dart';
import 'package:amplify_datastore_example/amplifyconfiguration.dart';
import 'package:amplify_flutter/amplify_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -83,11 +83,12 @@ class _MyAppState extends State<MyApp> {
// Configure

// Uncomment the below lines to enable online sync.
// await Amplify.addPlugin(AmplifyAPI());
// await Amplify.configure(amplifyconfig);
await Amplify.addPlugin(AmplifyAPI(
options: APIPluginOptions(modelProvider: ModelProvider.instance)));
await Amplify.configure(amplifyconfig);

// Remove this line when using the lines above for online sync
await Amplify.configure("{}");
// await Amplify.configure("{}");
} on AmplifyAlreadyConfiguredException {
print(
'Amplify was already configured. Looks like app restarted on android.');
Expand Down Expand Up @@ -162,11 +163,12 @@ class _MyAppState extends State<MyApp> {
void listenToHub() {
setState(() {
hubSubscription = Amplify.Hub.listen(HubChannel.DataStore, (msg) {
print(msg.type);
if (msg.type case DataStoreHubEventType.networkStatus) {
print('Network status message: $msg');
return;
}
print(msg);
// print(msg);
});
_listeningToHub = true;
});
Expand Down
79 changes: 40 additions & 39 deletions packages/amplify_datastore/example/lib/models/ModelProvider.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8b12e9

Please sign in to comment.