fromMap static method

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

Gets a possible ShowFileChooserRequest instance from a Map value.

Implementation

static ShowFileChooserRequest? fromMap(
  Map<String, dynamic>? map, {
  EnumMethod? enumMethod,
}) {
  if (map == null) {
    return null;
  }
  final instance = ShowFileChooserRequest(
    acceptTypes: List<String>.from(map['acceptTypes']!.cast<String>()),
    filenameHint: map['filenameHint'],
    isCaptureEnabled: map['isCaptureEnabled'],
    mode: switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => ShowFileChooserRequestMode.fromNativeValue(
        map['mode'],
      ),
      EnumMethod.value => ShowFileChooserRequestMode.fromValue(map['mode']),
      EnumMethod.name => ShowFileChooserRequestMode.byName(map['mode']),
    }!,
    title: map['title'],
  );
  return instance;
}