chrome_extension 0.2.0 chrome_extension: ^0.2.0 copied to clipboard
A library for accessing the `chrome.*` APIs available in Chrome extensions.
import 'package:chrome_extension/alarms.dart';
import 'package:chrome_extension/power.dart';
import 'package:chrome_extension/storage.dart';
void main() async {
// Use the chrome.power API
chrome.power.requestKeepAwake(Level.display);
// Use the chrome.storage API
await chrome.storage.local.set({'mykey': 'value'});
var values = await chrome.storage.local.get(null /* all */);
print(values['mykey']);
// Use the chrome.alarms API
await chrome.alarms.create('MyAlarm', AlarmCreateInfo(delayInMinutes: 2));
}