fromJson static method

InlineBannerConfig? fromJson(
  1. Map<String, dynamic> json
)

Implementation

static InlineBannerConfig? fromJson(Map<String, dynamic> json) {
  final slotKey = optString(json, 'slotKey').trim();
  final image = InlineBannerImageConfig.fromJson(optMap(json, 'image'));
  if (slotKey.isEmpty || image == null) return null;
  final layout = optMap(json, 'layout');
  return InlineBannerConfig(
    slotKey: slotKey,
    image: image,
    margin: InlineBannerMargin.fromJson(optMap(layout ?? const {}, 'margin')),
    onClick: _supportedFlow(optMap(json, 'onClick')),
  );
}