flutter_callkit_incoming.-错误信息



呼叫套件升级带来了新的问题,

名称不是事件的一部分-包中没有信息

getter 'name'没有为'CallEvent'类型定义。试着导入定义了'name'的库,将名称修改为现有getter的名称,或者定义一个名为'name'的getter或字段

CallEvent未定义

未定义名称'CallEvent'。尝试将名称更正为已定义的名称,或者定义name.dartundefined_identifier大小写表达式必须是常量

void setupNotificationAction() async {
FlutterCallkitIncoming.onEvent.listen((event) async {
switch (event!.name) {
case CallEvent.ACTION_CALL_INCOMING:
print('incoming call gaes');
break;
case CallEvent.ACTION_CALL_ACCEPT:
print('body ' + event.body['extra']['roomName']);
print('accept the data');
TimeSlot selectedTimeslot = await TimeSlotService()
.getTimeSlotById(event.body['extra']['selectedTimeslotId']);
Get.toNamed('/video-call', arguments: [
{
'timeSlot': selectedTimeslot,
'room': event.body['extra']['roomName'],
'token': event.body['extra']['token']
}
]);
break;
case CallEvent.ACTION_CALL_DECLINE:
print('declien call gaes');
break;
}
});
// connecticube.ConnectycubeFlutterCallKit.instance.init(
//   onCallAccepted: _onCallAccepted,
//   onCallRejected: _onCallRejected,
// );
}

对于有这个问题的人,这里有一个flutter_callkit_incoming包的链接(回答时版本为1.0.3+3)。

新版本显然是坏的。我建议使用v 1.0.2+2,直到它被修复。将此添加到您的pubspec中。yaml(不包括^)

flutter_callkit_incoming: 1.0.2+2

FlutterCallkitIncoming.onEvent.listen((CallEvent? event) {
switch (event?.name) {
case CallEvent.ACTION_CALL_INCOMING:
// TODO: received an incoming call
break;
case CallEvent.ACTION_CALL_START:
// TODO: started an outgoing call
// TODO: show screen calling in Flutter
break;
case CallEvent.ACTION_CALL_ACCEPT:
// TODO: accepted an incoming call
// TODO: show screen calling in Flutter
break;
case CallEvent.ACTION_CALL_DECLINE:
// TODO: declined an incoming call
break;
case CallEvent.ACTION_CALL_ENDED:
// TODO: ended an incoming/outgoing call
break;
case CallEvent.ACTION_CALL_TIMEOUT:
// TODO: missed an incoming call
break;
case CallEvent.ACTION_CALL_CALLBACK:
// TODO: only Android - click action `Call back` from missed call notification
break;
case CallEvent.ACTION_CALL_TOGGLE_HOLD:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_MUTE:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_DMTF:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_GROUP:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_AUDIO_SESSION:
// TODO: only iOS
break;
case CallEvent.ACTION_DID_UPDATE_DEVICE_PUSH_TOKEN_VOIP:
// TODO: only iOS
break;
}
});

相关内容

  • 没有找到相关文章

最新更新