Skip to main content

litehost 1.0.0 copy "litehost: ^1.0.0" to clipboard
litehost: ^1.0.0 copied to clipboard

Use SetLiteWeb's phone features (location, QR scanner, Bluetooth, sign-in, profile, storage and more) from a LiteStore mini app, with typed Dart APIs and a mock host for development in a normal browser.

litehost #

Use SetLiteWeb's phone features from a LiteStore mini app: location, QR scanner, Bluetooth, profile, sign-in, storage and more, with typed Dart APIs. Mini apps are web apps (Flutter web or any Dart web app) that SetLiteWeb downloads, verifies and runs offline inside its own screen.

import 'package:litehost/litehost.dart';

void main() {
  // Outside SetLiteWeb (e.g. `flutter run -d chrome`): pretend answers.
  if (!LiteHost.isAvailable) LiteHost.useMock(MockHost());
  runApp(const MyApp());
}

Future<void> findShops() async {
  try {
    final pos = await LiteHost.location.get(reason: 'To find shops near you');
    // ...
  } on LiteHostException catch (e) {
    if (e.error == LiteHostError.denied) showManualAddress();
  }
}

How it works #

  • Every feature that touches the user (location, camera, profile…) shows SetLiteWeb's consent sheet the first time; the answer is remembered per app. Pass reason to explain why you need it.
  • Your app can only use features it declares in litestore.yaml. Phones that lack a required feature never see your app in the store.
  • Call LiteHost.capabilities() to hide options the phone doesn't offer.

litestore.yaml #

id: com.example.duka        # also your link path: /a/com.example.duka/...
name: Duka
version: 1.0.0
summary: Order from shops near you.
developer: Example Ltd
category: shopping
requires: [location]        # app is hidden where these are missing
optional: [scanner, profile.name, storage]

Tools #

dart run litehost:check     # code uses only declared features?
dart run litehost:build     # flutter build web + zip + SHA-256 + listing
dart run litehost:build --dir dist   # package any already built site

The output in build/litestore/ is what you upload to LiteStore.

Features #

API Feature id Asks user
LiteHost.location.get() location yes
LiteHost.camera.request() / microphone.request() camera / microphone yes
LiteHost.bluetooth.scan()/connect()/read()/write()/notifications() bluetooth yes
LiteHost.wifi.get() wifi yes
LiteHost.clipboard.read() / write() clipboard.read / clipboard.write read only
LiteHost.profile.get({...}) profile.name / .phone / .email yes, per field
LiteHost.auth.token() auth.token yes
LiteHost.auth.browser(url) auth.browser no (browser sign-in)
LiteHost.scanner.scan() scanner no (host screen)
LiteHost.image.pick() image.pick no (host screen)
LiteHost.share() / openUrl() share / open.url no
LiteHost.haptics() / keepScreenOn() haptics / screen.keepOn no
LiteHost.storage.* storage no
LiteHost.device.info() device.info no
LiteHost.links.create(path) links no
LiteHost.notifications.show()/schedule()/cancel() notifications yes
LiteHost.biometric.confirm(reason) biometric no (phone's own prompt)
LiteHost.contacts.pick() contacts.pick no (user picks one)

Events: LiteHost.onPause, onResume, onLink.

Plain web features (audio/video playback, IndexedDB, navigator.onLine, device motion, speech synthesis…) work as in any browser and don't need this package.

1
likes
0
points
--
downloads

Publisher

verified publishersetliteweb.com

Use SetLiteWeb's phone features (location, QR scanner, Bluetooth, sign-in, profile, storage and more) from a LiteStore mini app, with typed Dart APIs and a mock host for development in a normal browser.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

archive, crypto, path, web, yaml

More

Packages that depend on litehost