fromMap static method
- Map<
String, dynamic> ? map, { - EnumMethod? enumMethod,
Gets a possible PrintJobSettings instance from a Map value.
Implementation
static PrintJobSettings? fromMap(
Map<String, dynamic>? map, {
EnumMethod? enumMethod,
}) {
if (map == null) {
return null;
}
final instance = PrintJobSettings(
collate: map['collate'],
colorMode: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobColorMode.fromNativeValue(
map['colorMode'],
),
EnumMethod.value => PrintJobColorMode.fromValue(map['colorMode']),
EnumMethod.name => PrintJobColorMode.byName(map['colorMode']),
},
duplexMode: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobDuplexMode.fromNativeValue(
map['duplexMode'],
),
EnumMethod.value => PrintJobDuplexMode.fromValue(map['duplexMode']),
EnumMethod.name => PrintJobDuplexMode.byName(map['duplexMode']),
},
faxNumber: map['faxNumber'],
firstPage: map['firstPage'],
footerHeight: map['footerHeight'],
footerUri: map['footerUri'],
forceRenderingQuality: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobRenderingQuality.fromNativeValue(
map['forceRenderingQuality'],
),
EnumMethod.value => PrintJobRenderingQuality.fromValue(
map['forceRenderingQuality'],
),
EnumMethod.name => PrintJobRenderingQuality.byName(
map['forceRenderingQuality'],
),
},
headerHeight: map['headerHeight'],
headerTitle: map['headerTitle'],
horizontalPagination: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobPaginationMode.fromNativeValue(
map['horizontalPagination'],
),
EnumMethod.value => PrintJobPaginationMode.fromValue(
map['horizontalPagination'],
),
EnumMethod.name => PrintJobPaginationMode.byName(
map['horizontalPagination'],
),
},
jobDisposition: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobDisposition.fromNativeValue(
map['jobDisposition'],
),
EnumMethod.value => PrintJobDisposition.fromValue(
map['jobDisposition'],
),
EnumMethod.name => PrintJobDisposition.byName(map['jobDisposition']),
},
jobName: map['jobName'],
jobSavingURL: map['jobSavingURL'] != null
? WebUri(map['jobSavingURL'])
: null,
lastPage: map['lastPage'],
margins: MapEdgeInsets.fromMap(map['margins']?.cast<String, dynamic>()),
maximumContentHeight: map['maximumContentHeight'],
maximumContentWidth: map['maximumContentWidth'],
mediaSize: PrintJobMediaSize.fromMap(
map['mediaSize']?.cast<String, dynamic>(),
enumMethod: enumMethod,
),
mustCollate: map['mustCollate'],
numberOfPages: map['numberOfPages'],
orientation: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobOrientation.fromNativeValue(
map['orientation'],
),
EnumMethod.value => PrintJobOrientation.fromValue(map['orientation']),
EnumMethod.name => PrintJobOrientation.byName(map['orientation']),
},
outputType: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobOutputType.fromNativeValue(
map['outputType'],
),
EnumMethod.value => PrintJobOutputType.fromValue(map['outputType']),
EnumMethod.name => PrintJobOutputType.byName(map['outputType']),
},
pageHeight: map['pageHeight'],
pageOrder: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobPageOrder.fromNativeValue(
map['pageOrder'],
),
EnumMethod.value => PrintJobPageOrder.fromValue(map['pageOrder']),
EnumMethod.name => PrintJobPageOrder.byName(map['pageOrder']),
},
pageRanges: map['pageRanges'],
pageWidth: map['pageWidth'],
pagesAcross: map['pagesAcross'],
pagesDown: map['pagesDown'],
pagesPerSide: map['pagesPerSide'],
paperName: map['paperName'],
printerName: map['printerName'],
resolution: PrintJobResolution.fromMap(
map['resolution']?.cast<String, dynamic>(),
enumMethod: enumMethod,
),
scalingFactor: map['scalingFactor'],
shouldPrintBackgrounds: map['shouldPrintBackgrounds'],
shouldPrintHeaderAndFooter: map['shouldPrintHeaderAndFooter'],
shouldPrintSelectionOnly: map['shouldPrintSelectionOnly'],
time: map['time'],
verticalPagination: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobPaginationMode.fromNativeValue(
map['verticalPagination'],
),
EnumMethod.value => PrintJobPaginationMode.fromValue(
map['verticalPagination'],
),
EnumMethod.name => PrintJobPaginationMode.byName(
map['verticalPagination'],
),
},
);
instance.animated = map['animated'];
instance.canSpawnSeparateThread = map['canSpawnSeparateThread'];
instance.copies = map['copies'];
instance.detailedErrorReporting = map['detailedErrorReporting'];
instance.handledByClient = map['handledByClient'];
instance.headerAndFooter = map['headerAndFooter'];
instance.isHorizontallyCentered = map['isHorizontallyCentered'];
instance.isVerticallyCentered = map['isVerticallyCentered'];
instance.printDialogKind = switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => PrintJobDialogKind.fromNativeValue(
map['printDialogKind'],
),
EnumMethod.value => PrintJobDialogKind.fromValue(map['printDialogKind']),
EnumMethod.name => PrintJobDialogKind.byName(map['printDialogKind']),
};
instance.showUI = map['showUI'];
instance.showsNumberOfCopies = map['showsNumberOfCopies'];
instance.showsPageRange = map['showsPageRange'];
instance.showsPageSetupAccessory = map['showsPageSetupAccessory'];
instance.showsPaperOrientation = map['showsPaperOrientation'];
instance.showsPaperSelectionForLoadedPapers =
map['showsPaperSelectionForLoadedPapers'];
instance.showsPaperSize = map['showsPaperSize'];
instance.showsPreview = map['showsPreview'];
instance.showsPrintPanel = map['showsPrintPanel'];
instance.showsPrintSelection = map['showsPrintSelection'];
instance.showsProgressPanel = map['showsProgressPanel'];
instance.showsScaling = map['showsScaling'];
return instance;
}