amqp_service 0.0.2
amqp_service: ^0.0.2 copied to clipboard
AMQP Plugin for Android.
import 'dart:developer';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:amqp_service/amqp_service.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
initPlatformState();
runApp(const MyApp());
AMQPService();
AMQPService.streamSubscription.onData((data) {
log(data);
});
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
return await AMQPService.startService(
host: 'your_host',
port: 5672,
username: 'your_user_name',
password: 'your_passs',
exchange: 'T-direct',
key: '5210015');
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}