generateAndDisplayQRCode function

Future<void> generateAndDisplayQRCode(
  1. String url
)

Generate and display QR code for the local server URL

Implementation

Future<void> generateAndDisplayQRCode(String url) async {
  try {
    print('\nšŸ“± QR Code for easy mobile access:');
    print('ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”');

    // Generate QR code using the QRGenerator class with smaller size
    QRGenerator.printQRCodeToTerminal(url, size: 2);

    print('ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜');
    print('šŸ“± Scan this QR code with your mobile device to access the app');
    print('šŸ”— Or manually visit: $url');
  } catch (e) {
    print('āš ļø  Could not generate QR code: $e');
    print('šŸ”— Please manually visit: $url');
  }
}