Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:absensi_flutter/ui/login_page.dart';
  3. import "package:dart_amqp/dart_amqp.dart";
  4. import 'package:flutter/services.dart';
  5.  
  6. void main(){
  7. SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
  8. statusBarColor: Colors.transparent,
  9. ));
  10. ConnectionSettings settings = new ConnectionSettings(
  11. host: "rmq2.pptik.id",
  12. authProvider:new PlainAuthenticator("absensi_selfie", "lkjhgfdsa123!"),
  13. virtualHost: "/absensi_selfie",
  14. );
  15.  
  16. Client client = new Client(settings: settings);
  17.  
  18. String queueTag = "android_publish_dev";
  19.  
  20. client
  21. .channel()
  22. .then((Channel channel) => channel.queue(queueTag, durable: true))
  23. .then((Queue queue) {
  24. print(" [*] Waiting for messages in ${queueTag}. To Exit press CTRL+C");
  25. return queue.consume(consumerTag: queueTag, noAck: true);
  26. })
  27. .then((Consumer consumer) {
  28. consumer.listen((AmqpMessage event)async {
  29. print(" [x] Received "+event.payloadAsString);
  30. });
  31. });
  32. runApp(new MyApp());
  33.  
  34. }
  35.  
  36. class MyApp extends StatefulWidget {
  37.  
  38. @override
  39. _MyappStatePage createState() => new _MyappStatePage();
  40. }
  41.  
  42. class _MyappStatePage extends State<MyApp>{
  43. String value = 'hello word';
  44. @override
  45. // void initState() {
  46. // // TODO: implement initState
  47. // super.initState();
  48. // _firebaseMessaging.configure(
  49. // onLaunch: (Map<String,dynamic>msg){
  50. // print("onLaunch dude");
  51. // },
  52. // onResume: (Map<String,dynamic>msg){
  53. // print("onResume dude");
  54. // },
  55. // onMessage: (Map<String,dynamic>msg){
  56. // print("onMessage dude");
  57. // }
  58. // );
  59. //
  60. // _firebaseMessaging.requestNotificationPermissions(
  61. // const IosNotificationSettings(
  62. // sound: true,
  63. // alert: true,
  64. // badge: true
  65. // )
  66. // );
  67. // _firebaseMessaging.onIosSettingsRegistered.listen((IosNotificationSettings setting){
  68. // print('IOS Setting Registerd');
  69. // });
  70. //
  71. // _firebaseMessaging.getToken().then((token){
  72. // update(token);
  73. // });
  74. // }
  75. //
  76. // update(String token){
  77. // print(token);
  78. // value = token;
  79. // setState(() {
  80. //
  81. // });
  82. // }
  83.  
  84. void database(){
  85. print("udhh database");
  86. }
  87. @override
  88. Widget build(BuildContext context) {
  89. return new MaterialApp(
  90. debugShowCheckedModeBanner: false,
  91. title: '',
  92. theme: new ThemeData(
  93.  
  94. primarySwatch: Colors.blue,
  95. ),
  96. home: new LoginPage(),
  97. );
  98. }
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement