flutter_saucenao_img_search

Last updated:

0 purchases

flutter_saucenao_img_search Image
flutter_saucenao_img_search Images
Add to Cart

Description:

flutter saucenao img search

Introduction #
An convenient way to use SauceNAO API in Flutter/Dart
Quick start #
Install #
A convenient way to add denpendency of this package to your project is run pub command in your project
flutter pub add flutter_saucenao_img_search
copied to clipboard
Besides, You can still update the Flutter project pubspec.yaml file to add package dependency.
dependencies:
...
flutter_saucenao_img_search:
git:
url: https://github.com/nfnfgo/flutter_saucenao_img_search.git
ref: main
copied to clipboard
After updating pubspec.yaml, you may need to restart your IDE.
Search Picture by URI #
import 'package:flutter_saucenao_img_search/flutter_saucenao_img_search.dart';
import 'package:flutter_test/flutter_test.dart';

void main() async {
{
// Create ImageSearcher
ImageSearcher imgSearcher = ImageSearcher(
searcherConfig: ImageSearcherConfig(
// Use your own SauceNAO APIKEY instead
apiKey: 'YOUR_API_KEY_HERE'),
);

// Search Picture by uri
SearchResult? result = await imgSearcher.uri(
uriStr:
'https://pbs.twimg.com/media/FmWFWu4agAEGo7P?format=jpg&name=large',
);

if (result != null) {
for (SearchResultItem resultItem in result.resultItemsList) {
print('-----------------------------------------------');
print('Thumbnail: ${resultItem.thumbnailLink}');
// Actually, the items in resultItemsList could be the subtype of the
// SearchResult*tem class, such as PixivSearchResultItem, which contains
// more info of some specified platform
if (resultItem is PixivSearchResultItem) {
print('PixivID: ${resultItem.pixivId}');
print('Pixiv User Page: ${resultItem.artistLink}');
}
print('Source Links: ${resultItem.sourceLinksList}');
}
}
}
}
copied to clipboard
If you run the code in Dart, you could get below output
Thumbnail: https://img1.saucenao.com/res/pixiv/10449/manga/104491469_p1.jpg?auth=ZpchuXwRGpw9dYG3BvU-zg&exp=1674590400
PixivID: 104491469
Pixiv User Page: https://www.pixiv.net/users/212801
Source Links: [https://www.pixiv.net/member_illust.php?mode=medium&illust_id=104491469]
-----------------------------------------------
Thumbnail: https://img3.saucenao.com/booru/0/6/0689c9516d7e95987e34820ece877cd4_2.jpg?auth=luScLjJjXOP6MJ1OHKFWzQ&exp=1674590400
Source Links: [https://danbooru.donmai.us/post/show/5979370, https://yande.re/post/show/1054789, https://gelbooru.com/index.php?page=post&s=view&id=8128874]
-----------------------------------------------
Thumbnail: https://img3.saucenao.com/booru/d/1/d150c1887bd1e0a33a4e014cdca712ba_2.jpg?auth=8n5L2vv1CAitOUWfYWp2JA&exp=1674590400
Source Links: [https://danbooru.donmai.us/post/show/5979362, https://gelbooru.com/index.php?page=post&s=view&id=8128881]
copied to clipboard
Search Pictures By File #
If you want to search pictures on your local device, you could use ImageSeacher.file(). Just replace the code example below
SearchResult? result = await imgSearcher.file(
File(r'YOUR_FILE_PATH_HERE'),
);
copied to clipboard
You could also read the package API Reference Document
API Reference Document #
https://pub.dev/documentation/flutter_saucenao_img_search/latest/
Advanced Guide #
Exception #
This package uses some custom Exception class to help you catch and handle Exception more acurately.
You can check Api Reference Document for more info about each custom Exception class.
For More #
Search Image Without using SauceNAO API Key

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.