Getting this error while trying to save pdf file which I am creating :

```
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;

class PrintBarcodeScreen extends StatefulWidget {
  @override
  _PrintBarcodeScreenState createState() => _PrintBarcodeScreenState();
}

class _PrintBarcodeScreenState extends State<PrintBarcodeScreen> {
  var dt = DateTime.now();
  final pdf = pw.Document();

  generatePdf() {
    pdf.addPage(
      pw.MultiPage(
          pageFormat: PdfPageFormat.a4,
          margin: pw.EdgeInsets.all(16),
          build: (pw.Context context) {
            return <pw.Widget>[
              pw.Header(
                level: 0,
                child: pw.Row(
                  mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
                  children: [
                    pw.Text(
                      DateFormat.yMMMEd().format(dt),
                      textScaleFactor: 2,
                      // style: getTheme.textTheme.headline6,
                    ),
                    pw.Text(
                      DateFormat.jms().format(dt),
                      // style: getTheme.textTheme.headline6,
                    ),
                  ],
                ),
              ),
              pw.BarcodeWidget(
                barcode: pw.Barcode.gs128(),
                color: PdfColor.fromHex("#000000"),
                data: '123456789123',
                // width: screenSize.width * 0.8,
                height: 90,
              ),
              pw.Table.fromTextArray(context: context, data: <List<String>>[
                <String>['Year', 'Ipsum', 'Lorem'],
                <String>['SN0', 'GFG1'],
                <String>['SN1', 'GFG2'],
              ]),
            ];
          }),
    );
  }

  Future savePdf() async {
    Directory documentDirectory = await getApplicationDocumentsDirectory();
    String documentPath = documentDirectory.path;
    File receiptFile = File("$documentPath/receipt.pdf");
    receiptFile.writeAsBytesSync(pdf.save()); // this line is showing error pdf.save() is underlined red
  }

  @override
  Widget build(BuildContext context) {
    .........
}

```

Screenshot: [![screenshot](https://i.stack.imgur.com/zIoFm.jpg)](https://i.stack.imgur.com/zIoFm.jpg)

Couldn't find much about it anywhere. Not much experienced yet with flutter to understand the depth of this error. Little I do understand that this is data type mismatch situation. I saw writeAsBytesSync has List bytes parameter, could figure out how can I change my pdf data to int.