Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:absensi_flutter/ui/login_page.dart';
- import "package:dart_amqp/dart_amqp.dart";
- import 'package:flutter/services.dart';
- void main(){
- SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
- statusBarColor: Colors.transparent,
- ));
- ConnectionSettings settings = new ConnectionSettings(
- host: "rmq2.pptik.id",
- authProvider:new PlainAuthenticator("absensi_selfie", "lkjhgfdsa123!"),
- virtualHost: "/absensi_selfie",
- );
- Client client = new Client(settings: settings);
- String queueTag = "android_publish_dev";
- client
- .channel()
- .then((Channel channel) => channel.queue(queueTag, durable: true))
- .then((Queue queue) {
- print(" [*] Waiting for messages in ${queueTag}. To Exit press CTRL+C");
- return queue.consume(consumerTag: queueTag, noAck: true);
- })
- .then((Consumer consumer) {
- consumer.listen((AmqpMessage event)async {
- print(" [x] Received "+event.payloadAsString);
- });
- });
- runApp(new MyApp());
- }
- class MyApp extends StatefulWidget {
- @override
- _MyappStatePage createState() => new _MyappStatePage();
- }
- class _MyappStatePage extends State<MyApp>{
- String value = 'hello word';
- @override
- // void initState() {
- // // TODO: implement initState
- // super.initState();
- // _firebaseMessaging.configure(
- // onLaunch: (Map<String,dynamic>msg){
- // print("onLaunch dude");
- // },
- // onResume: (Map<String,dynamic>msg){
- // print("onResume dude");
- // },
- // onMessage: (Map<String,dynamic>msg){
- // print("onMessage dude");
- // }
- // );
- //
- // _firebaseMessaging.requestNotificationPermissions(
- // const IosNotificationSettings(
- // sound: true,
- // alert: true,
- // badge: true
- // )
- // );
- // _firebaseMessaging.onIosSettingsRegistered.listen((IosNotificationSettings setting){
- // print('IOS Setting Registerd');
- // });
- //
- // _firebaseMessaging.getToken().then((token){
- // update(token);
- // });
- // }
- //
- // update(String token){
- // print(token);
- // value = token;
- // setState(() {
- //
- // });
- // }
- void database(){
- print("udhh database");
- }
- @override
- Widget build(BuildContext context) {
- return new MaterialApp(
- debugShowCheckedModeBanner: false,
- title: '',
- theme: new ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: new LoginPage(),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement