stream 相关问题

流是一系列可以以串行方式访问的数据元素。对于Java 8的新Stream API,请改用java-stream标签。

点击通知颤动后执行操作?

您好,我正在尝试使用 flutter_local_notifications 单击通知后导航到第二个屏幕 https://pub.dev/packages/flutter_local_notifications 最终行为主体 您好,我正在尝试使用 flutter_local_notifications 单击通知后导航到第二个屏幕 https://pub.dev/packages/flutter_local_notifications final BehaviorSubject<String?> selectNotificationSubject = BehaviorSubject<String?>(); final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); void initializeNotifcations() async { var initialzationSettings = InitializationSettings(android: initializationSettingsAndroid); await flutterLocalNotificationsPlugin.initialize(initialzationSettings, onDidReceiveBackgroundNotificationResponse: (NotificationResponse notificationResponse) { selectNotificationSubject.add(notificationResponse.payload); }); flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< AndroidFlutterLocalNotificationsPlugin>()! .requestPermission(); } void configureDidReceiveLocalNotificationSubject() { print('test01'); selectNotificationSubject.stream.listen((String? payload) async { print('test02'); }); } 不听直播,如果您有一个如何使用最佳实践进行制作的示例,它将有所帮助 void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); await initNotification(); FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler; ... } Future initNotification() async { var initializationSettingsAndroid = new AndroidInitializationSettings("@drawable/kin_removebg"); var initializationSettingsIOS = new IOSInitializationSettings( requestAlertPermission: false, requestBadgePermission: false, requestSoundPermission: false, onDidReceiveLocalNotification: (int? id, String? title, String? body, String? payload) async {}); var initializationSettings = new InitializationSettings( android: initializationSettingsAndroid, iOS: initializationSettingsIOS); final NotificationAppLaunchDetails? notificationAppLaunchDetails = await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails(); final didNotificationLaunchApp = notificationAppLaunchDetails?.didNotificationLaunchApp ?? false; if (didNotificationLaunchApp) { var payload = notificationAppLaunchDetails!.payload; onSelectNotification(payload); } else { await flutterLocalNotificationsPlugin.initialize( initializationSettings, onDidReceiveNotificationResponse:onSelectNotification, onDidReceiveBackgroundNotificationResponse: onSelectNotification, } } onSelectNotification(NotificationResponse notificationResponse) async { var payloadData = jsonDecode(notificationResponse.payload); print("payload $payload"); if(payloadData["type"]=="something" && payloadData["id"]!="something"){ Navigator.of(navigatorKey.currentContext!).push( MaterialPageRoute( builder: (context) => SomethingScreen(id: payloadData["id"],))); } } flutterLocalNotificationsPlugin .getNotificationAppLaunchDetails() .then((value) async { if (!value.didNotificationLaunchApp || value.payload == null) return; // do something. } }

回答 2 投票 0

使用FFMPEG将RTSP流录制到本地文件

我正在寻找一个片段(C/ObjC),其中使用最新版本的 FFMPEG 来捕获 RTSP 或 RTP 流并将其保存为 .mp4 文件到设备上(以/停止录制按钮) 阿尔姆...

回答 3 投票 0

python:使用 websocket-client 建立与 Elevenlabs 的 Websocket 连接

在 elevenlabs 中,您现在还可以将流功能与输入流一起使用。然而,必须为此建立套接字连接。 不幸的是我必须自己实现 websocket 连接

回答 1 投票 0

通过打印将数据输出到 sys.stdout 并输出到带时间戳的记录器

我在 Jupyter 笔记本中有包含一系列 print() 语句的代码。我想用与标准输出和时间戳记录器相同的输出替换每个输出。这是怎么回事...

回答 1 投票 0

Java 中的链接Optional 和Stream(最好是11)

我有一个 Foo 对象列表,其中每个 Foo 包含一个名称和一个 List。 我在尝试着 查找 fooList 是否包含具有目标名称的 Foo 对象,如果存在这样的元素, 鳍...

回答 1 投票 0

如何在同一个流中使用多个filter+map?

如何将其合并到单个流? 列表 Type1ErrorRows = error.stream() .filter(c -> (c.getClass() == Type1Error.class)) .map(c -> ((类型1错误...

回答 1 投票 0

Java:如何在没有辅助结构或 peek() 的情况下对 Stream 中的元素进行计数和处理?

我正在使用Java流,我需要一种方法来计算流中的所有元素,同时使用skip()和limit()对它们的子集执行操作。 我的目标是...

回答 1 投票 0

如何使用ofstream作为struct - 函数arg的一部分

我正在尝试使用ofstream,在函数WriteLine()的函数getlog()中打开。我有一个名为 LOG 的结构: 结构日志{ wchar_t 日志文件[PARM_MAX_SIZE]; std::ofstream* 流; }; 哪个...

回答 1 投票 0

音频仅在 http 上播放,而不是 https

我通过shoutcast 服务器有一个音频直播流,它在http 上播放正常,但在https 上播放不了。 我目前的流地址为http。我尝试过将流地址切换为http...

回答 1 投票 0

黑色pdf正在从nodejs Nestjs下载

我有第三方API来提供pdf文件,当我直接从邮递员或雷霆客户端点击该url时,它会提供pdf文件,效果非常好。 当点击这个网址时,我正在设置这些头...

回答 1 投票 0

Flink - Statebackend 可以允许清除 RocksDB 表中的旧数据吗?

在下面的代码中: 类丰富流{ private val checkpointsDir = "file://${System.getProperty("user.dir")}/checkpoints/" private val rockDBStateDir = "fil...

回答 1 投票 0

保存来自网络摄像机 RTP 流的 JPEG 文件

我有一个 RTP 流套接字,从三星网络摄像机接收 JPEG 流。 我不太了解 JPEG 格式的工作原理,但我确实知道传入的 JFIF 或 JPEG 流给了我...

回答 1 投票 0

如何使用 Flask 将文本流式传输到客户端而不添加换行符?

我需要我的 Flask 应用程序能够传输动态生成的文本数据。 为了测试 Flask 的流响应,我使用以下代码: 服务器端路由: @app.route('/test_streaming') 定义

回答 1 投票 0

无法从 GZIPInputStream 读取小型压缩字节数组

我遇到了一个问题,但无法解决它或找到有用的答案。 我有一段压缩字节数组的代码: 尝试(最终 ByteArrayOutputStream byteArrayOutputStream = 新

回答 1 投票 0

使用列表验证函数内的验证方法返回枚举对象

我有一个问题,如果可能的话,我想用 Java 流来解决。这是我的代码。 类 Foo { 私有字符串名称; 私人字符串姓氏; // getter 和 setter } 枚举 FooError ...

回答 1 投票 0

Flink - keyBy() 函数是否在内部对 flink 运算符进行分区?

以下代码摘自文档: 打包支出报告; 导入 org.apache.flink.streaming.api.datastream.DataStream; 导入 org.apache.flink.streaming.api.environment.

回答 1 投票 0

精确输出流浮点数

我有浮点数精度问题: int 主函数(无效){ 双b = 106.829599; 浮动 a = b; std::cerr << std::setprecision(6) << "a = " << a << "; b = " <&...

回答 1 投票 0

如何将变量传递到并行异步 HTTP GET 请求中?

我对 Rust 编程非常陌生,我不明白如何将变量传递到这段代码中。我需要执行并行异步 HTTP GET 请求。我确实收到了字节,我会...

回答 1 投票 0

java套接字/输出流写入:它们会阻塞吗?

如果我只写入输出流上的套接字,它会阻塞吗?只有读取才能阻塞,对吧?有人告诉我写入可以阻塞,但我只看到 s 的读取方法的超时功能...

回答 2 投票 0

使用 java 8 流从两个单独的对象列表中获取匹配对象对的列表

我有一个要求,我希望在某些条件下从两个对象中获得一对匹配的对象 例如: 公司{ ID; 公司名称: 地址; } 员工 { ID; 公司ID; 姓名; 多布; 地址; } 所以从

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.