toMap method

Map<String, dynamic> toMap()

转换为Map

Implementation

Map<String, dynamic> toMap() {
  final Map<String, dynamic> map = {};

  // 必填参数
  map['storyId'] = storyId;

  // 可选参数 - 只有非null的才添加
  if (startChapter != null) map['startChapter'] = startChapter;
  if (defaultTextSize != null) map['defaultTextSize'] = defaultTextSize;
  if (endPageRecSize != null) map['endPageRecSize'] = endPageRecSize;
  if (hideBack != null) map['hideBack'] = hideBack;
  if (pageTurnType != null) map['pageTurnType'] = pageTurnType;
  if (fontSizeLevel != null) map['fontSizeLevel'] = fontSizeLevel;

  // 自定义广告参数 - 章间广告
  if (customMiddlePageAdViewId != null) {
    map['customMiddlePageAdViewId'] = customMiddlePageAdViewId;
  }
  if (middlePageInterval != null) {
    map['middlePageInterval'] = middlePageInterval;
  }

  // 自定义广告参数 - 段间广告
  if (customMiddleLineAdViewId != null) {
    map['customMiddleLineAdViewId'] = customMiddleLineAdViewId;
  }
  if (middleLineStartLine != null) {
    map['middleLineStartLine'] = middleLineStartLine;
  }
  if (middleLineInterval != null) {
    map['middleLineInterval'] = middleLineInterval;
  }

  // 自定义广告参数 - Banner广告
  if (customBannerAdViewId != null) {
    map['customBannerAdViewId'] = customBannerAdViewId;
  }

  return map;
}