Notice
Recent Posts
Recent Comments
Link
250x250
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags more
Archives
Today
Total
관리 메뉴

혼자서 앱 만드는 개발자 함께하는 AI 세상

flutter sse 적용 테스트 ? 본문

플러터 앱개발

flutter sse 적용 테스트 ?

혼앱사 2023. 12. 18. 21:34
반응형
import 'package:eventsource/eventsource.dart';
import 'package:seesaw/core/app_export.dart';
import 'package:seesaw/presentation/get_started_screen/models/get_started_model.dart';
import 'package:screen_capture_event/screen_capture_event.dart';
import '../../../secure_shot.dart';
import 'package:universal_html/html.dart' as html;

/// A controller class for the GetStartedScreen.
///
/// This class manages the state of the GetStartedScreen, including the
/// current getStartedModelObj
class GetStartedController extends GetxController {
  Rx<GetStartedModel> getStartedModelObj = GetStartedModel().obs;
  final ScreenCaptureEvent screenListener = ScreenCaptureEvent();

  @override
  Future<void> onInit() async {
    super.onInit();
    screenListener.addScreenRecordListener((recorded) {
      ///Recorded was your record status (bool)
    });

    screenListener.addScreenShotListener((filePath) {});

    ///You can add multiple listener ^-^
    screenListener.addScreenRecordListener((recorded) {
      print("Hi i'm 2nd Screen Record listener");
    });
    screenListener.addScreenShotListener((filePath) {
      print("Wohooo i'm 2nd Screenshot listener");
    });

    ///Start watch
    screenListener.watch();
    SecureShot.on();
    // TODO: implement onInit
    //Get.focusScope?.requestFocus(FocusNode());
    //  Get.focusScope!.unfocus();

    html.EventSource eventSource =

    eventSource.onMessage.listen((event) {
      print("listen  성공");
    });
    eventSource.onError.listen((event) {
      print(event);
    });
  }
}

 

  •  
728x90
반응형
Comments