我无法按给定属性对可观察的 RxList 进行排序。当我使用 BloC 方法(使用简单的列表)时,排序工作得很好。
\n最近,我将状态管理更改为 GetX ( https://github.com/jonataslaw/getx ) 包,因为我看到了几个优点(不需要上下文、转换到页面等)。
\n这里有两种情况,我的不好,前面没有解释,让我把小黄瓜放进去
\n场景一:
\nGiven user in Posts Screen\nWhen user Pull down to get Newest posts\nThen user get the newly fetched posts on top of the previous loaded list\nRun Code Online (Sandbox Code Playgroud)\n场景2:
\nGiven user in Posts Screen\nWhen user reaches the end of the list\nThen user get more posts at the end of the previous loaded list\nRun Code Online (Sandbox Code Playgroud)\npost_model.dart
\nclass Post {\n final int id;\n final …Run Code Online (Sandbox Code Playgroud) 当应用程序关闭或在后台时,我试图停止来自 firebase_message 的默认通知。
我想在应用程序关闭时或使用 local_notifications 插件在后台显示自定义通知,它按预期工作,问题存在于发送消息时,应用程序显示相同的通知两次,默认情况下显示 1 个通知,另一个显示自定义通知。
我无法实现停止默认通知。有人能在这里指出我的错误吗?
初始代码来自 firebase 消息传递示例,删除了不必要的片段并添加了自定义通知。
还附上了当前(不良行为)的图像
如前所述,相同的通知显示两次,想要摆脱图像上显示的第一个通知。
这是我的代码:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'utils/utils.dart';
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
print('_firebaseMessagingBackgroundHandler');
Future onDidReceiveLocalNotification(
int? id, String? title, String? body, String? payload) async {
print('onDidReceiveLocalNotification'); …Run Code Online (Sandbox Code Playgroud)