restage 2.0.0 copy "restage: ^2.0.0" to clipboard
restage: ^2.0.0 copied to clipboard

Server-driven UI for Flutter. Build any surface — onboarding, messages, surveys, paywalls — in your own Flutter widgets and ship updates over the air. Content, not code.

example/README.md

Restage example #

Write a surface in plain Flutter, compile it to a render blob, and render it. All offline, no account.

1. Author a surface #

A surface is a plain Flutter widget annotated with its surface type (@Paywall here; use @Screen or @FlowGraph(surface: ...) for ordinary screens and flows). It uses your own widgets and your app's theme.

import 'package:flutter/material.dart';
import 'package:restage/restage.dart';

part 'restage.generated/welcome.restage.g.dart';

@Screen(id: 'welcome', surface: Surface.onboarding)
final class WelcomeScreen extends StatelessWidget {
  const WelcomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text('Welcome', style: Theme.of(context).textTheme.headlineMedium),
        const SizedBox(height: 8),
        const Text('A simple server-driven screen.'),
      ],
    );
  }
}

2. Compile it #

dart run build_runner build

This writes generated, inert render artifacts. Commit the generated output your app bundles. The fixed lib/generated/restage.publication.json records the publication identity and exact artifact closure.

Push the generated surface by id, then publish the pushed revision:

restage surface push welcome
restage surface publish welcome

A push uploads a version. A publish makes it live.

3. Render it #

void main() {
  Restage.configure(apiKey: 'local-dev');
  runApp(const MaterialApp(
    home: Scaffold(
      body: RestageScreen(
        screen: welcomeScreenRef,
        unavailable: SurfaceScreenUnavailablePolicy.hide(),
      ),
    ),
  ));
}

RestageScreen decodes the blob and renders it as real Flutter widgets, in your own widget tree.

Full, runnable examples #

A complete gallery (paywalls, onboarding, a permission prompt, an in-app message, a survey, and custom widgets) lives in apps/examples. Copy one to start. The full walkthrough is in QUICKSTART.md.

0
likes
160
points
135
downloads

Documentation

API reference

Publisher

verified publisherrestage.dev

Weekly Downloads

Server-driven UI for Flutter. Build any surface — onboarding, messages, surveys, paywalls — in your own Flutter widgets and ship updates over the air. Content, not code.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#server-driven-ui #remote-ui #flutter

License

BSD-3-Clause (license)

Dependencies

crypto, flutter, http, meta, path_provider, restage_core, restage_cupertino, restage_material, restage_measurement_schema, restage_shared, rfw, shared_preferences, web_socket_channel

More

Packages that depend on restage