fromMap static method

AppwinPause? fromMap(
  1. Object? raw
)

Parses what the native side sends over the channel.

Returns null when raw is not a map or has no string since, so a malformed pause reads as no pause rather than crashing the host app.

Implementation

static AppwinPause? fromMap(Object? raw) {
  if (raw is! Map) return null;
  final since = raw['since'];
  if (since is! String) return null;
  final title = raw['title'];
  final message = raw['message'];
  return AppwinPause(
    since: since,
    title: title is String ? title : '',
    message: message is String ? message : '',
  );
}