PhoneCall.fromCallLogEntry constructor
PhoneCall.fromCallLogEntry(
- CallLogEntry call
Implementation
factory PhoneCall.fromCallLogEntry(CallLogEntry call) {
DateTime timestamp = DateTime.fromMicrosecondsSinceEpoch(call.timestamp!);
String type = "unknown";
switch (call.callType) {
case CallType.answeredExternally:
type = 'answered_externally';
break;
case CallType.blocked:
type = 'blocked';
break;
case CallType.incoming:
type = 'incoming';
break;
case CallType.missed:
type = 'missed';
break;
case CallType.outgoing:
type = 'outgoing';
break;
case CallType.rejected:
type = 'rejected';
break;
case CallType.voiceMail:
type = 'voice_mail';
break;
default:
type = "unknown";
break;
}
return PhoneCall(timestamp, type, call.duration, call.formattedNumber,
call.number, call.name);
}