Chrome Extensions API
Project is WIP, starting with chrome.tabs mostly implemented (methods, not events).
- Set permissions in
manifest.jsonrequired to use specifc API's according found at Chrome Reference - If building with Flutter,
- Make the appropriate changes to the normal working directory/files.
- Examples:
manifest.json(example: service workers)index.json
- Customize the build command
flutter build web --web-renderer html --csp(for this project in theexampledirectory) - or reference on Building Chrome Extension using Flutter
- Make the appropriate changes to the normal working directory/files.
import 'package:chromeapi/chromeapi.dart';
Future<Tab> getActiveTab() async {
QueryInfo queryInfo = QueryInfo(active: true, lastFocusedWindow: true);
List<Tab> tabs = await chrome.tabs.query(queryInfo);
final tab = tabs.singleWhere((tab) => tab.url != null && tab.url!.isNotEmpty);
return tab;
}Above function is used in example package, an Chrome Extension that, when clicked, generates a QR code for url from the active tab.
Note, if using Flutter make sure to avoid naming collision, example...
// chromeapi also imports a 'Tab' class
import 'package:flutter/material.dart' hide Tab;