Plugin.Scanner 0.0.1-alpha

This is a prerelease version of Plugin.Scanner.
dotnet add package Plugin.Scanner --version 0.0.1-alpha
                    
NuGet\Install-Package Plugin.Scanner -Version 0.0.1-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Scanner" Version="0.0.1-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Scanner" Version="0.0.1-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Scanner" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plugin.Scanner --version 0.0.1-alpha
                    
#r "nuget: Plugin.Scanner, 0.0.1-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Plugin.Scanner@0.0.1-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plugin.Scanner&version=0.0.1-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Scanner&version=0.0.1-alpha&prerelease
                    
Install as a Cake Tool

📱 Plugin.Scanner

EARLY ALPHA

  • Planned
    • More options for IBarcodeScanner(Zoom, multiple recognition, enable/disable highlighting, recognition area)
    • Custom data scanner view with overlay etc.
    • Custom overlay for IBarcodeScanner
    • Custom behavior for IBarcodeScanner
    • TextScanner and DocumentScanner

🚀 Mobile cross platform data scanner

NuGet License Platform Support Framework Support

This plugin aims to enalbe simple, fast and customizable data scanning(barcodes, text, documents...) using native Android and iOS APIs ML Kit and Vision Kit.

  • Platform support iOS 16+ and Android 23+
  • Native AI supported detection
  • One Shared API cross platforms and frameworks
  • Scan barcodes with only 2 lines of code

🚀 Get started

🔧 Platform specific setup

To access the scanner functionality, the following platform-specific setup is required. The application will crash without this setup.

<details> <summary><b>iOS</b></summary>

In the Info.plist file, add the following keys and values:

<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to scan data.</string>

</details>

<details> <summary><b>Android</b></summary>

The CAMERA permission is required and must be configured in the Android project. In addition:

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

</details>

⬇️ Installation

Install the NuGet package:

<details> <summary><b>MAUI</b></summary>

dotnet add package Plugin.Scanner.Maui

</details>

<details> <summary><b>Uno</b></summary>

dotnet add package Plugin.Scanner.Uno

</details>

<details> <summary><b>Avalonia</b></summary>

dotnet add package Plugin.Scanner.Avalonia

</details>

Please note: If you encounter this issue, you will need to enable long path support as described here.

⚙️ Setup

<details> <summary><b>MAUI</b></summary>

Enable the plugin in your MauiProgram.cs:

namespace Plugin.Scanner.Maui.Hosting;

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder.UseScanner();
    return builder.Build();
}

</details>

<details> <summary><b>Uno</b></summary>

Enable the plugin in your App.xaml.cs:

using Plugin.Scanner.Uno.Hosting;

protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
    IApplicationBuilder builder = this.CreateBuilder(args)
        .UseScanner();
    MainWindow = builder.Window;

    Host = await builder.NavigateAsync<Shell>();
}

</details>

<details> <summary><b>Avalonia</b></summary>

Initialize the plugin in your android MainActivity.cs:

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
     
    Hosting.Scanner.Init(this);
}

</details>

🔳 Barcode scanning

<details> <summary><b>Implementation details</b></summary>

</details>

<details> <summary><b>MAUI & Uno</b></summary>

Resolve the registered IBarcodeScanner service and scan a single barcode in all supported formats

using Plugin.Scanner.Core.Barcode;
using Plugin.Scanner.Core.Exceptions;

public class MainViewModel
{
    private readonly IBarcodeScanner _barcodeScanner;

    public MainViewModel(IBarcodeScanner barcodeScanner)
    {
        _barcodeScanner = barcodeScanner;
    }

    public async Task ScanBarcode()
    {
        try
        {
            IBarcode barcode = (await _barcodeScanner.ScanAsync(new BarcodeScanOptions() { Formats = BarcodeFormat.All }).ConfigureAwait(false)).RawValue;
        }
        catch(BarcodeScanException exception)
        {
            Debug.WriteLine(exception);
        }
    }
}

</details>

<details> <summary><b>Avalonia</b></summary>

Since dependency injection is not available out of the box a static implementation of the scanner must be used. If you use dependency injection register the IBarcodeScanner serivce with the IServiceCollection.AddBarcodeScanner() extension method. See Maui and Uno examples.

using Plugin.Scanner.Core.Barcode;
using Plugin.Scanner.Core.Exceptions;

public partial class MainViewModel
{
    public async Task ScanBarcode()
    {
        try
        {
            IBarcode barcode = (await BarcodeScanner.Default.ScanAsync(new BarcodeScanOptions() { Formats = BarcodeFormat.All }).ConfigureAwait(false)).RawValue;
        }
        catch (BarcodeScanException exception)
        {
            Debug.WriteLine(exception);
        }
    }
}

</details>

You want to detect only specific format(s)? Create options and set the target formats(s)

var options = new BarcodeScanOptions
{
    Formats = BarcodeFormat.QR | BarcodeFormat.Ean13
};

using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
var barcode = await scanner.ScanAsync(options, cts.Token);
Console.WriteLine($"Scanned: {barcode.RawValue}");
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Plugin.Scanner:

Package Downloads
Plugin.Scanner.Maui

Package Description

Plugin.Scanner.Uno

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha 54 2/13/2026