Flutter-based emulator for the Even Hub sdk (https://www.npmjs.com/package/@evenrealities/even_hub_sdk) for Even Realities G2.
- A
flutter_inappwebviewhost that loads a localindex.html. - A glass display renderer that mirrors the EvenHub container API (list/text/image).
- A small, easy-to-edit bridge host (
EvenAppBridgeHost) that routes messages between JS and Flutter in order to implement an emulated Evenhub api. - Log console and webpage error logs
After building and running, the app starts with a default index.html that demonstrates various sdk event handling.
To load your own index.html, click the folder/open index button and pick a file. Paths (for example javascript src paths) are relative to the directory of the index.html.
If you edit the index.html or any referenced code, you can click the reload button to reload the page and reinit the emulator.
There's an example app in example/demo_v1 that is mostly copied from the sdk examples.
The api mostly works as you'd expect, however I'm making some guesses at how it will actually work on a phone based on the docs. Please provide any feedback on what's off and I'll fix.
Biggest known issues:
- The event model and controls are a guess based off the docs, it's possible when events are sent (for example on scroll) may he slightly off.
- Actual image data is still untested (working on that)
If you need platform folders (android/, ios/, etc.), run:
flutter create .
This keeps lib/ and pubspec.yaml intact while generating platform scaffolding.
lib/bridge/even_app_bridge.dart- Implements the EvenHub API surface (
evenAppMessagehandler). - Emits device status + evenHub events back to JS.
- Implements the EvenHub API surface (
lib/bridge/event_pump.dart- Central place to tune when events are pushed to JS.
lib/glasses/glasses_model.dart- Models + parsing of container payloads.
lib/glasses/glasses_screen.dart- Renders containers and lets you click list/text to fire events.
lib/main.dart- Wires WebView + glasses UI together and injects the JS handler.
{
type: 'call_even_app_method',
method: 'createStartUpPageContainer',
data: { /* payload */ }
}{
type: 'listen_even_app_data',
method: 'evenHubEvent',
data: {
type: 'listEvent',
jsonData: { /* event payload */ }
}
}createStartUpPageContaineris enforced to run once.- At most 4 containers are allowed; exactly one must have
isEventCapture=1. - Images accept
imageData(base64 ornumber[]). Invalid images are shown with a placeholder.