request method

PrintRequest request(
  1. BuildContext context, {
  2. bool preview = false,
  3. bool singleCell = false,
})

What the renderer needs for the chosen template.

Implementation

PrintRequest request(
  BuildContext context, {
  bool preview = false,
  bool singleCell = false,
}) {
  final template = _template!;
  final job = _job;
  List<Map<String, dynamic>>? cells;
  if (job != null && dataProvider.acceptsRows(template)) {
    final rows = job.expanded;
    final source = singleCell && rows.isNotEmpty ? [rows.first] : rows;
    cells = [for (final row in source) row.dataFor(template)];
  }
  return PrintRequest(
    template: template,
    paper: paper!,
    localeName: Localizations.localeOf(context).toString(),
    sampleData: dataProvider.sampleData(context, template),
    pageNotice: dataProvider.pageNotice(context, template),
    copies: singleCell ? 1 : _copies,
    cellData: cells,
    skippedPerSheet: singleCell ? const [] : _skippedPerSheet,
    showCutGuides: preview,
    singleCellPage: singleCell,
  );
}