inlay 0.1.1 copy "inlay: ^0.1.1" to clipboard
inlay: ^0.1.1 copied to clipboard

Embed Flutter in native iOS and Android apps with type-safe navigation and key-value storage synced in real time across engines and native code.

example/README.md

inlay example #

A minimal tour of the inlay API. For a complete, runnable project — a Flutter module plus native iOS and Android host apps exercising every feature — see the example/ directory in the repository.

Route and store classes are generated from annotated Dart schemas by inlay_gen.

1. Define routes and stores (Dart schema) #

// A Flutter screen — navigable from native or from other Flutter screens.
@InlayFlutterRoute('/sounds-notifications/:contactId')
class SoundsNotificationsPage {
  const SoundsNotificationsPage({required this.contactId});
  final String contactId;
}

// A native screen — navigable from Flutter.
@InlayNativeRoute()
class NativeEditProfilePage {
  const NativeEditProfilePage({required this.contactId});
  final String contactId;
}

// A key-value store synced across every engine and native code.
@InlayStore(key: 'sounds_notifications')
class SoundsNotificationsStore {
  const SoundsNotificationsStore({
    @InlayStoreKey() required this.contactId,
    this.mute = false,
  });

  final String contactId;
  final bool mute;
}

Running code generation produces type-safe route and store classes for Dart, Swift, and Kotlin.

2. Navigate #

// Open a Flutter screen (a new native container with its own engine).
await InlayNavigator.instance.push(
  SoundsNotificationsPage(contactId: 'abc-123'),
);

// Open a native screen from Flutter.
await InlayNavigator.instance.push(
  NativeEditProfilePage(contactId: 'abc-123').toNativeRoute(),
);

3. Share state #

// Read and write the generated store from Dart. Writes are broadcast to every
// other Flutter engine and native scope in real time.
final store = SoundsNotificationsStore(
  KeyValueStorage.instance,
  contactId: 'abc-123',
);
await store.setMute(true);

See the Navigation and State Management guides for the full API.

1
likes
160
points
179
downloads

Documentation

API reference

Publisher

verified publisherleancode.co

Weekly Downloads

Embed Flutter in native iOS and Android apps with type-safe navigation and key-value storage synced in real time across engines and native code.

Repository (GitHub)
View/report issues

Topics

#add-to-app #navigation #flutter-module #codegen #state

License

Apache-2.0 (license)

Dependencies

bloc, flutter, meta

More

Packages that depend on inlay

Packages that implement inlay