google_vision_flutter

Last updated:

0 purchases

google_vision_flutter Image
google_vision_flutter Images
Add to Cart

Description:

google vision flutter

Google Vision Images Flutter Widget #


Native Dart package that integrates Google Vision features, including image labeling, face, logo, and landmark detection into Flutter applications.
Please feel free to submit PRs for any additional helper methods, or report an issue for a missing helper method and I'll add it if I have time available.
Table of Contents #

Google Vision Images Flutter Widget

Table of Contents
Recent Changes

New for v2.0.0
New for v1.4.0


Getting Started

pubspec.yaml
Obtaining Authorization Credentials
Usage of the GoogleVisionBuilder Widget


ShoutOut
Contributing





Recent Changes #
New for v2.0.0 #

Even though this package worked when used with the web platform the pub.dev analyzer would not show it as web platform compatible due to the use of the universal_io package which has a dependency on dart:io. This version has removed the universal_io dependency from the core package, so some related method signatures have been removed.
The deprecated methods from in v1.3.x have been removed in this version.
Logging functionality has been added to the package

final googleVision = await GoogleVision(LogLevel.all).withJwtFile('service_credentials.json');
copied to clipboard
New for v1.4.0 #

A breaking change from the previous version is that the GoogleVision class now follows the Singleton design pattern. Now the object is instantiated as follows:


// Old method from v1.3.x and earlier
// final googleVision = await GoogleVision.withJwtFile('service_credentials.json');

// New
final googleVision = await GoogleVision().withJwtFile('service_credentials.json');
copied to clipboard
Getting Started #
pubspec.yaml #
To use this package, add the dependency to your pubspec.yaml file:
dependencies:
...
google_vision_flutter: ^2.0.0
copied to clipboard
Obtaining Authorization Credentials #
Authenticating to the Cloud Vision API requires an API key or a JSON file with the JWT token information. The JWT token can obtained by creating a service account in the Google API console.
Usage of the GoogleVisionBuilder Widget #
See the example app for the full code.
import 'package:flutter/material.dart';
import 'package:google_vision_flutter/google_vision_flutter.dart';
import 'example_base.dart';

class LabelDetectionPage extends ExampleBase {

// final googleVision =
// GoogleVision().withAsset('assets/service_credentials.json');

static const assetName = 'assets/setagaya_small.jpg';

final _processImage = Image.asset(
assetName,
fit: BoxFit.fitWidth,
);

LabelDetectionPage({
super.key,
required super.googleVision,
required super.title,
});

@override
Widget build(BuildContext context) => SafeArea(
child: Scaffold(
appBar: getAppBar(context),
body: simpleColumn(
assetName: assetName,
sampleImage: _processImage,
result: GoogleVisionImageBuilder.labelDetection(
googleVision: googleVision,
imageProvider: _processImage.image,
builder: (
BuildContext context,
List<EntityAnnotation>? entityAnnotations,
) =>
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: entityAnnotations!
.map((entity) => Text(
'${(entity.score! * 100).toStringAsFixed(2)}% - ${entity.description}'))
.toList()),
),
),
),
),
);
}

/// See the example project for all the necessary code.

copied to clipboard

ShoutOut #

To Andrii Syrokomskyi for creating flutter_image_converter, I've borrowed some of the code included in the flutter_image_converter in this package. This package originally had a dependency on flutter_image_converter, but that had to be removed to achieve web platform support.

Contributing #
Any help from the open-source community is always welcome and needed:

Found an issue?

Please fill a bug report with details.


Need a feature?

Open a feature request with use cases.


Are you using and liking the project?

Promote the project: create an article or post about it
Make a donation


Do you have a project that uses this package

let's cross promote, let me know and I'll add a link to your project


Are you a developer?

Fix a bug and send a pull request.
Implement a new feature.
Improve the Unit Tests.


Have you already helped in any way?

Many thanks from me, the contributors and everybody that uses this project!



If you donate 1 hour of your time, you can contribute a lot, because others will do the same, just be part and start with your 1 hour.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.