MessageNotification.fromJson constructor
MessageNotification.fromJson(
- Map<String, dynamic> jsonData
)
Implementation
MessageNotification.fromJson(Map<String, dynamic> jsonData) {
id = TypeSafeConversion.nullSafeInt(jsonData['id']);
title = TypeSafeConversion.nullSafeString(jsonData['title']);
body = TypeSafeConversion.nullSafeString(jsonData['body']);
payload = TypeSafeConversion.nullSafeString(jsonData['payload']);
status = TypeSafeConversion.nullSafeInt(jsonData['status']);
createdAt = TypeSafeConversion.nullSafeString(jsonData['created_at']);
receiver = TypeSafeConversion.nullSafeString(jsonData['receiver']);
String img = TypeSafeConversion.nullSafeString(jsonData['image']);
image = (img.isNotEmpty)
? img.startsWith('http')
? jsonData['image']
: '${ApiConstantDev.urlWebServer}/storage/app/public/notification/${jsonData['image']}'
: '';
channel = ( (jsonData['channel']) == null )? ChannelModel(): ChannelModel.fromJson( json.decode(jsonData['channel']) );
}