appsync_subscription

Last updated:

0 purchases

appsync_subscription Image
appsync_subscription Images
Add to Cart

Description:

appsync subscription

Flutter AppSync subscription Plugin #

This plugin for Flutter
handles subscripe to AWS AppSync subscription.
Getting Started #
Add this to your package's pubspec.yaml file:
dependencies:
appsync_subscription: ^1.0.1
copied to clipboard
Usage #
Import the package with
import 'package:appsync_subscription/appsync_subscription.dart';
copied to clipboard

final endPoint = "https://yourappsync.appsync-api.region.amazonaws.com/graphql";
final apiKey = "your-api-key";
final port = 443;

class _MyHomePageState extends State<MyHomePage> {
final _appsyncSubscription = new Subscription(endPoint, apiKey, port);

@override
Widget build(BuildContext context) {
final query = {
'query': '''subscription {
onPublishResult(id: "12345") {
id
}
}
'''
};
_appsyncSubscription.subscripeToSubscription(query, _callBackFunc);
}
void _callBackFunc(data) {
print('Data received from subscription $data');
// update widget with new data
setState(() {
});
}
}

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.