Chrome Extensions API


Project is WIP, starting with chrome.tabs mostly implemented (methods, not events).


  • Set permissions in manifest.json required 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


Import the library, no use of js namespaces.

So to get chrome.tabs import... `import 'package:chromeapi/tabs.dart';

and as an example on getting the active tab, use query...

Future<Tab> getActiveTab() async {
  QueryInfo queryInfo = QueryInfo(active: true, lastFocusedWindow: true);
  // Chrome library, not like JS namespaces
  // `chrome.tabs.query` just `query` in this case
  List<Tab> tabs = await query(queryInfo);
  return tabs.singleWhere((tab) => tab.url != null && tab.url!.isNotEmpty);