toMap method
转换为 Map,仅包含非空字段
Implementation
Map<String, dynamic> toMap() {
final Map<String, dynamic> map = <String, dynamic>{};
if (cardStyle != null) {
map['cardStyle'] = switch (cardStyle!) {
GridVideoCardStyle.normal => 'normal',
GridVideoCardStyle.staggered => 'staggered',
};
}
if (scene != null && scene!.isNotEmpty) {
map['scene'] = scene;
}
if (enableRefresh != null) {
map['enableRefresh'] = enableRefresh;
}
if (reportTopPadding != null) {
map['reportTopPadding'] = reportTopPadding;
}
if (extra != null && extra!.isNotEmpty) {
map['extra'] = extra;
}
return map;
}