小编koo*_*kid的帖子

Flutter 本地通知错误:空对象引用上的“int java.lang.Integer.intValue()”

当我激活预定的 Flutter 本地通知时,它崩溃了。我在 drawable 文件夹中有“launcher_icon”,有来自 github 的所有配置。知道是什么导致了错误?我有 2 个带有 Flutter 本地通知的项目——一个在虚拟机上工作,但不在真实设备上(一旦通知被触发就退出),另一个一开始就不起作用。

这是我的代码:

import 'package:coronada_19/models/infection.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:latlong/latlong.dart' as ds;
import 'package:flutter/cupertino.dart';
import 'package:rxdart/subjects.dart';

import 'package:flutter_local_notifications/flutter_local_notifications.dart';

class ReceivedNotification {
  final int id;
  final String title;
  final String body;
  final String payload;

  ReceivedNotification(
      {@required this.id,
      @required this.title,
      @required this.body,
      @required this.payload});
}

final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
    FlutterLocalNotificationsPlugin();

// Streams are created so that app can respond to notification-related events since the plugin is initialised in the `main` function
final …
Run Code Online (Sandbox Code Playgroud)

android flutter

8
推荐指数
2
解决办法
4401
查看次数

标签 统计

android ×1

flutter ×1