Nova AVX

pub package License: MIT

A comprehensive Flutter package for QR code scanning and product authentication with advanced image quality analysis and ML-powered verification.

Features

  • πŸ” Advanced QR Code Scanning - High-precision QR code detection with angle tolerance
  • πŸ“Έ Camera Integration - Safe camera management with lifecycle handling
  • 🧠 ML-Powered Authentication - Product verification using machine learning
  • πŸ“Š Image Quality Analysis - Low light detection, contrast analysis, and sharpness evaluation
  • πŸ”’ Secure API Integration - Configurable API endpoints for your backend
  • πŸ“± Cross-Platform - Works on both iOS and Android
  • 🎨 Customizable UI - Beautiful, modern interface with customizable themes

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  nova_avx: ^1.0.2

Quick Start

1. Configure API

import 'package:nova_avx/nova_avx.dart';

void main() {
  // Configure your API endpoint
  NovaAvxConfig.configureApi(
    baseUrl: 'https://your-api-endpoint.com/api',
    timeoutSeconds: 50,
  );
  
  runApp(const MyApp());
}

2. Add Permissions

Android (android/app/src/main/AndroidManifest.xml):

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />

iOS (ios/Runner/Info.plist):

<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan QR codes</string>

3. Use the Package

import 'package:nova_avx/nova_avx.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => NovaAvx.startScanning(),
                ),
              );
            },
            child: const Text('Start QR Scanning'),
          ),
        ),
      ),
    );
  }
}

⚠️ Important: Use Public API Only

DO NOT access internal classes directly:

// ❌ DON'T DO THIS - Internal classes are not exported
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (context) => const AvxNovaCameraScreen(), // This will cause errors
  ),
);

DO use the public API:

// βœ… DO THIS - Use the public API
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (context) => NovaAvx.startScanning(), // This is the correct way
  ),
);

API Reference

NovaAvx (Main API)

The main public interface for the Nova AVX package:

// Start QR code scanning and product authentication
Widget cameraScreen = NovaAvx.startScanning();

// Alternative method with explicit naming
Widget cameraScreen = NovaAvx.getCameraScreen();

NovaAvxConfig

Configure the package settings:

// Set API base URL
NovaAvxConfig.setApiBaseUrl('https://your-api.com');

// Set timeout
NovaAvxConfig.setApiTimeout(60);

// Configure both at once
NovaAvxConfig.configureApi(
  baseUrl: 'https://your-api.com',
  timeoutSeconds: 60,
);

CameraScreen

The main camera interface for QR scanning:

const CameraScreen()

ImageProcessingScreen

Handles post-capture image processing and API calls:

const ImageProcessingScreen()

Configuration

API Configuration

The package requires you to configure your API endpoint. This ensures your API keys and URLs remain secure in your application code.

NovaAvxConfig.configureApi(
  baseUrl: 'https://your-backend-api.com/authenticate',
  timeoutSeconds: 50,
);

Image Quality Thresholds

You can customize image quality thresholds by modifying the constants in your app:

// These are the default values
AppConstants.defaultBrightnessThreshold = 70.0;
AppConstants.defaultContrastThreshold = 150.0;
AppConstants.defaultSharpnessThreshold = 18.0;

Example

Check out the example directory for a complete implementation.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.

Libraries

nova_avx