$UikSnackBarPropsFromJson function

UikSnackBarProps $UikSnackBarPropsFromJson(
  1. Map<String, dynamic> json
)

Implementation

UikSnackBarProps $UikSnackBarPropsFromJson(Map<String, dynamic> json) {
  final UikSnackBarProps uikSnackBarProps = UikSnackBarProps();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    uikSnackBarProps.id = id;
  }

  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    uikSnackBarProps.title = title;
  }

  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    uikSnackBarProps.description = description;
  }

  final String? backgroundColor =
      jsonConvert.convert<String>(json['backgroundColor']);
  if (backgroundColor != null) {
    uikSnackBarProps.backgroundColor = Color(int.parse(backgroundColor));
  }

  final String? leftElement = jsonConvert.convert<String>(json['leftElement']);
  if (leftElement != null) {
    uikSnackBarProps.leftElement =
        UikIcon(WidgetType.UikText, UikIconProps.fromJson(json['leftElement']));
  }

  final UikAction? action = jsonConvert.convert<UikAction>(json['action']);
  if (action != null) {
    uikSnackBarProps.action = action;
  }
  return uikSnackBarProps;
}