# From Structured Outputs to A2UI Surfaces: Migrating to Flutter GenUI SDK

DevFeed: [From Structured Outputs to A2UI Surfaces: Migrating to Flutter GenUI SDK](<https://devfeed.tech/articles/from-structured-outputs-to-a2ui-surfaces-migrating-to-flutter-genui-sdk-23050.md>)

Original publisher: [Read original article](<https://medium.com/flutter-community/from-structured-outputs-to-a2ui-surfaces-migrating-to-flutter-genui-sdk-4f09aeacee80?source=rss----86fb29d7cc6a---4>)

Author: Cagatay Ulusoy

Published: 2026-07-08T15:52:59Z

Content type: tutorial

Language: en

Sources: [Flutter Community - Medium](<https://devfeed.tech/sources/flutter-community-medium.md>)

Topics: [Flutter](<https://devfeed.tech/topics/flutter.md>), [SDKs](<https://devfeed.tech/topics/sdks.md>), [Finite-state machine](<https://devfeed.tech/topics/finite-state-machine.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Firebase](<https://devfeed.tech/topics/firebase.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [a2ui](<https://devfeed.tech/tags/a2ui.md>), [ai](<https://devfeed.tech/tags/ai.md>), [firebase](<https://devfeed.tech/tags/firebase.md>), [flutter](<https://devfeed.tech/tags/flutter.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [generative-ui](<https://devfeed.tech/tags/generative-ui.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [json](<https://devfeed.tech/tags/json.md>), [sdk](<https://devfeed.tech/tags/sdk.md>), [state](<https://devfeed.tech/tags/state.md>)

## AI overview

A tutorial on migrating a hand-built generative UI feature based on Gemini structured outputs to the official Flutter GenUI SDK. It describes a Finnish language-learning app that generates images on demand and uses a five-step wizard to improve image variety.

## Source excerpt

Part 3 of a series "Building Image Assisted Language Learning Practice with Flutter, Firebase and Gemini." Part 1 built the image generation and annotation pipeline. Part 2 built a generative UI framework by hand, using Gemini structured outputs. This part is the migration: same feature, official Flutter GenUI SDK. A year ago, Finnish It was just a side project. This spring, I watched it at the Google Cloud Next developer keynote, and again in the Flutter keynote at Google I/O. It still feels surreal to type that. I am grateful to the Flutter and Firebase teams for the collaboration. This series is my way of giving back. I hope it makes Flutter GenUI SDK click for you the way building this feature made it click for me. Finnish it app featured in Cloud Next and Google IOQuick Recap One of the app's practice exercises is simple: show the learner an image, and they describe it in 🇫🇮 Finnish. The images are generated on demand, not fetched from a fixed image database. In Part 2 the problem was variety. A broad topic like "a native Finnish animal in its habitat" kept producing the same handful of scenes. Turning up temperature did not fix it, because it was never really a sampling problem. An under-specified prompt has a few big probability peaks, and the sampler just jitters around them. The fix was to stop asking the model to "be random" and move the entropy into the UI: a five-step wizard where the user picks the season, the setting, the story, the framing, and the visible details. Gemini designs the questions; the user provides the variety. That worked. The repetition problem was solved. The machine I built by hand To make it work, I built a small finite state machine (FSM) which walked the user through five steps. Each step asked Gemini for question set, constrained by a response schema, and parsed the JSON into a typed object that a widget could render: final response = await model.generateContent( [Content.text(_buildRefinementStateRequest(state, topic, selections