fromDynamic static method

JsonHeroBuilder? fromDynamic(
  1. dynamic map, {
  2. JsonWidgetRegistry? registry,
})

Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:

{
  "createRectTween": "<CreateRectTween>",
  "flightShuttleBuilder": "<HeroFlightShuttleBuilder>",
  "placeholderBuilder": "<HeroPlaceholderBuilder>",
  "tag": "<Object>",
  "transitionOnUserGestures": "<bool>"
}

As a note, the CreateRectTween, HeroFlightShuttleBuilder and HeroPlaceholderBuilder cannot be decoded via JSON. Instead, the only way to bind those values to the builder is to use a function or a variable reference via the JsonWidgetRegistry.

Implementation

static JsonHeroBuilder? fromDynamic(
  dynamic map, {
  JsonWidgetRegistry? registry,
}) {
  JsonHeroBuilder? result;

  if (map != null) {
    result = JsonHeroBuilder(
      createRectTween: map['createRectTween'],
      flightShuttleBuilder: map['flightShuttleBuilder'],
      placeholderBuilder: map['placeholderBuilder'],
      tag: map['tag'],
      transitionOnUserGestures: JsonClass.parseBool(
        map['transitionOnUserGestures'],
      ),
    );
  }

  return result;
}