fromMap static method

CreateWindowAction? fromMap(
  1. Map<String, dynamic>? map, {
  2. EnumMethod? enumMethod,
})
override

Gets a possible CreateWindowAction instance from a Map value.

Implementation

static CreateWindowAction? fromMap(
  Map<String, dynamic>? map, {
  EnumMethod? enumMethod,
}) {
  if (map == null) {
    return null;
  }
  final instance = CreateWindowAction(
    request: URLRequest.fromMap(
      map['request']?.cast<String, dynamic>(),
      enumMethod: enumMethod,
    )!,
    isForMainFrame: map['isForMainFrame'],
    androidIsDialog: map['isDialog'],
    iosWindowFeatures: IOSWKWindowFeatures.fromMap(
      map['windowFeatures']?.cast<String, dynamic>(),
      enumMethod: enumMethod,
    ),
    isDialog: map['isDialog'],
    windowFeatures: WindowFeatures.fromMap(
      map['windowFeatures']?.cast<String, dynamic>(),
      enumMethod: enumMethod,
    ),
    windowId: map['windowId'],
  );
  instance.androidHasGesture = map['hasGesture'];
  instance.hasGesture = map['hasGesture'];
  instance.androidIsRedirect = map['isRedirect'];
  instance.isRedirect = map['isRedirect'];
  instance.iosWKNavigationType = switch (enumMethod ??
      EnumMethod.nativeValue) {
    EnumMethod.nativeValue => IOSWKNavigationType.fromNativeValue(
      map['navigationType'],
    ),
    EnumMethod.value => IOSWKNavigationType.fromValue(map['navigationType']),
    EnumMethod.name => IOSWKNavigationType.byName(map['navigationType']),
  };
  instance.navigationType = switch (enumMethod ?? EnumMethod.nativeValue) {
    EnumMethod.nativeValue => NavigationType.fromNativeValue(
      map['navigationType'],
    ),
    EnumMethod.value => NavigationType.fromValue(map['navigationType']),
    EnumMethod.name => NavigationType.byName(map['navigationType']),
  };
  instance.iosSourceFrame = IOSWKFrameInfo.fromMap(
    map['sourceFrame']?.cast<String, dynamic>(),
    enumMethod: enumMethod,
  );
  instance.sourceFrame = FrameInfo.fromMap(
    map['sourceFrame']?.cast<String, dynamic>(),
    enumMethod: enumMethod,
  );
  instance.iosTargetFrame = IOSWKFrameInfo.fromMap(
    map['targetFrame']?.cast<String, dynamic>(),
    enumMethod: enumMethod,
  );
  instance.targetFrame = FrameInfo.fromMap(
    map['targetFrame']?.cast<String, dynamic>(),
    enumMethod: enumMethod,
  );
  instance.shouldPerformDownload = map['shouldPerformDownload'];
  return instance;
}