VideoCardEvent.fromMap constructor

VideoCardEvent.fromMap(
  1. Map<String, dynamic> map
)

从Map创建事件

Implementation

factory VideoCardEvent.fromMap(Map<String, dynamic> map) {
  final String typeString = (map['type'] as String? ?? '').trim();
  final VideoCardEventType type = _parseVideoCardEventType(typeString);

  return VideoCardEvent(
    type: type,
    videoId: map['videoId'] as String?,
    data: castMapOrNull(map['data']),
    error: map['error'] as String?,
    errorCode: map['code'] as int?,
    isLike: map['isLike'] as bool?,
    isSucceed: map['isSucceed'] as bool?,
    title: map['title'] as String?,
    userName: map['userName'] as String?,
    commentCount: map['commentCount'] as int?,
    publishTime: map['publishTime'] as int?,
  );
}