【发布时间】:2021-01-04 14:58:58
【问题描述】:
我正在尝试在以下 json 中访问重定向 url
尝试使用print('on launch ${message['data'].redirect_url}');
但出现运行时错误。
这是进入 message['data'] =>
的响应 I/flutter (23626): on launch {type: api-testing, click_action: FLUTTER_NOTIFICATION_CLICK, redirect_url: https://google.com}
我怎样才能只访问作为字符串的重定向 URL?
【问题讨论】:
-
message['data']的数据类型是什么? -
onMessage: (Map
message) async { print('on launch ${message['data']}');打印('*************1'); print('关于消息 $message'); }, -
看看上面的代码你就会明白
-
你能发布
print(message['data'].runtimeType);的输出吗?