scanCode static method

Future<String?> scanCode({
  1. required BarcodeFormat typeOfCode,
  2. required BuildContext context,
  3. Widget? title,
  4. bool centerTitle = false,
  5. Color foregroundColor = Colors.black,
  6. Color backgroundColor = Colors.white,
})

Scan some type of BarCode like QR code, etc.

Implementation

static Future<String?> scanCode({
  required BarcodeFormat typeOfCode,
  required BuildContext context,
  ///Goes on the appbar
  Widget? title,
  final bool centerTitle = false,
  final Color foregroundColor = Colors.black,
  final Color backgroundColor = Colors.white,
})async{
  String? data = await Navigator.push(context, MaterialPageRoute(
      builder: (context)=> Scanner(
        typeOfCode: typeOfCode,
        foregroundColor: foregroundColor,
        backgroundColor: backgroundColor,
        title: title,
        centerTitle: centerTitle,
      ),
    ),
  );
  //Return the QR code result, might be null
  return data;
}