google_lens_uploader 0.0.2 copy "google_lens_uploader: ^0.0.2" to clipboard
google_lens_uploader: ^0.0.2 copied to clipboard

A Flutter package to upload an image to Google Lens via WebView and scrape basic info.

example/lib/main.dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:google_lens_uploader/google_lens_uploader.dart';


void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const DemoApp());
}

class DemoApp extends StatelessWidget {
  const DemoApp({super.key});
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Google Lens Uploader Demo',
      home: DemoPage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class DemoPage extends StatefulWidget {
  const DemoPage({super.key});

  @override
  State<DemoPage> createState() => _DemoPageState();
}

class _DemoPageState extends State<DemoPage> {
  String _status = 'idle';
  String _result = '';

  @override
  Widget build(BuildContext context) {
    // NOTE: update this path to a real image on your device when testing
    final file = File('/absolute/path/to/local.jpg');

    return Scaffold(
      appBar: AppBar(title: const Text('Google Lens Uploader Demo')),
      body: Column(
        children: [
          Expanded(
            child: file.existsSync()
                ? LensUploadView.fromFile(
                    file,
                    onStatus: (s) => setState(() => _status = s),
                    onResult: (r) => setState(() => _result = '${r.title}\n\n${r.description}'),
                  )
                : Center(child: Text('Please update example file path.\nCurrent: ${file.path}')),
          ),
          Container(
            padding: const EdgeInsets.all(12),
            color: Colors.grey.shade100,
            width: double.infinity,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text('Status: $_status', style: const TextStyle(fontWeight: FontWeight.bold)),
                const SizedBox(height: 8),
                Text('Result:\n$_result'),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
0
likes
150
points
26
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package to upload an image to Google Lens via WebView and scrape basic info.

Homepage

License

MIT (license)

Dependencies

flutter, path_provider, webview_flutter

More

Packages that depend on google_lens_uploader