小编yag*_*ete的帖子

从 Flutter 应用程序的 getX dart 包中对 RxList 进行排序

我无法按给定属性对可观察的 RxList 进行排序。当我使用 BloC 方法(使用简单的列表)时,排序工作得很好。

\n

最近,我将状态管理更改为 GetX ( https://github.com/jonataslaw/getx ) 包,因为我看到了几个优点(不需要上下文、转换到页面等)。

\n

这里有两种情况,我的不好,前面没有解释,让我把小黄瓜放进去

\n

场景一

\n
Given 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\n
Run Code Online (Sandbox Code Playgroud)\n

场景2:

\n
Given 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\n
Run Code Online (Sandbox Code Playgroud)\n

post_model.dart

\n
class Post {\n  final int id;\n  final …
Run Code Online (Sandbox Code Playgroud)

sorting list observable flutter

2
推荐指数
1
解决办法
2万
查看次数

firebase_messaging onBackgroundMessage local_notifications

当应用程序关闭或在后台时,我试图停止来自 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)

push-notification flutter firebase-cloud-messaging

2
推荐指数
1
解决办法
3611
查看次数