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');
  }
}