AI Chat

Loading preview

Starting the Flutter app

A Flutter AI chat UI with simulated streaming replies, user and bot bubbles, and an input bar.

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

How it works

Replies are simulated, and the screen says so: no model is called. _send appends the user’s _Msg, then _simulatedTokens emits the same canned reply word by word from a Stream.periodic, growing _partialReply while the list follows it. _TypingDots shows until the first token. The send button becomes stop while streaming, which keeps the partial text, and dispose cancels the subscription.

Adapting it

  • Replace _simulatedTokens with your provider’s token stream, and remove the demo caption.
  • Add an onError to the listen call, because a simulated stream can’t fail but yours can.