Home Flutter How to Collect and Track AI Response Feedback in Flutter

How to Collect and Track AI Response Feedback in Flutter

12
0

Build a response-level feedback flow for Flutter that survives network failures and gives AI teams enough context to fix bad answers.

A user asks an AI assistant about a refund policy. The first answer cites the wrong policy, so they tap thumbs down and regenerate it. The second answer gets it right. If the app stores one rating per conversation, the team may see a negative vote without knowing which answer earned it.

The fix starts with the data model. Give every generated answer a stable response ID, attach feedback to that ID, and measure how many answers receive a rating. That makes each vote traceable while keeping the Flutter interface as simple as two buttons.

1. Attach feedback to the exact answer the user saw

Create a new responseId for every generation, including when a user regenerates an answer. Keep conversationId for grouping and traceId for investigation. On the backend, the trace or response record can identify the model version, prompt version, and source documents used. That lets an engineer check whether an incorrect citation came from retrieval or from how the model used the retrieved text.

FieldWhere it comes fromWhat it’s for
responseIdServer, once per generated answerLinks feedback to the exact answer
conversationIdServer-side conversation recordGroups related messages and regenerations
ratingFlutter UIRecords helpful or unhelpful
reasonCodeOptional, structured follow-upDistinguishes inaccurate answers, missing sources, and incomplete answers
commentOptional user inputCaptures details the reason codes miss
traceIdServer-side response recordConnects the vote to model, prompt, and retrieval metadata

Place the controls beneath the completed answer. Save the rating on tap, then offer an optional follow-up such as “What went wrong?” A short list of reasons makes recurring issues easier to count. Keep comments in a restricted feedback store and give users a clear choice before attaching conversation content or files. Google’s Gemini feedback flow illustrates this approach by making reasons, comments, and previously uploaded files optional.

2. Save feedback with an idempotent API

A mobile request can reach the server even when the client times out waiting for a reply. If the user taps again, the backend should update the same feedback record. A PUT endpoint with a unique database key on (workspace_id, response_id, user_id) provides a straightforward contract. The server derives the user and workspace from the authenticated session, checks access to the response, and upserts the rating. Repeating the same PUT has the same intended effect as sending it once.

PUT /v1/ai/responses/resp_42/feedback
Authorization: Bearer <access-token>
Content-Type: application/json

{
  "rating": "unhelpful",
  "reasonCode": "missing_sources"
}

If the user changes a rating, keep one current vote for reporting. If the product also needs an audit trail, record revisions separately and count the latest vote per user and response in the dashboard. Return the persisted rating with the answer on reload so the selection survives an app restart.

3. Show saved feedback in Flutter and let users retry

This widget assumes a Material 3 app. It delegates networking to saveRating, which should call the authenticated PUTendpoint and throw if the save fails. Pass the server’s existing rating as initialRating and mount the widget with ValueKey(responseId) so a regenerated answer gets fresh widget state. Flutter’s http package supports cross-platform networking, and Material 3’s IconButton supports selected and unselected states.

import 'package:flutter/material.dart';

enum AiRating { helpful, unhelpful }

class AiResponseFeedback extends StatefulWidget {
  const AiResponseFeedback({
    super.key,
    required this.responseId,
    required this.saveRating,
    this.initialRating,
  });

  final String responseId;
  final AiRating? initialRating;
  final Future<void> Function(String responseId, AiRating rating) saveRating;

  @override
  State<AiResponseFeedback> createState() => _AiResponseFeedbackState();
}

class _AiResponseFeedbackState extends State<AiResponseFeedback> {
  AiRating? _savedRating;
  bool _saving = false;
  String? _status;

  @override
  void initState() {
    super.initState();
    _savedRating = widget.initialRating;
  }

  Future<void> _submit(AiRating rating) async {
    if (_saving || _savedRating == rating) return;

    setState(() {
      _saving = true;
      _status = 'Saving feedback…';
    });

    try {
      await widget.saveRating(widget.responseId, rating);
      if (!mounted) return;
      setState(() {
        _savedRating = rating;
        _saving = false;
        _status = 'Feedback saved';
      });
    } catch (_) {
      if (!mounted) return;
      setState(() {
        _saving = false;
        _status = 'Couldn’t save feedback. Tap again to retry.';
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Wrap(
      crossAxisAlignment: WrapCrossAlignment.center,
      children: [
        IconButton(
          tooltip: 'Helpful response',
          isSelected: _savedRating == AiRating.helpful,
          icon: const Icon(Icons.thumb_up_outlined),
          selectedIcon: const Icon(Icons.thumb_up),
          onPressed: _saving ? null : () => _submit(AiRating.helpful),
        ),
        IconButton(
          tooltip: 'Unhelpful response',
          isSelected: _savedRating == AiRating.unhelpful,
          icon: const Icon(Icons.thumb_down_outlined),
          selectedIcon: const Icon(Icons.thumb_down),
          onPressed: _saving ? null : () => _submit(AiRating.unhelpful),
        ),
        if (_status != null)
          Semantics(liveRegion: true, child: Text(_status!)),
      ],
    );
  }
}

The selection updates after the server confirms the save. For a product that needs offline feedback, persist pending votes in a local queue, label them as pending, and sync the latest vote for each response when the device reconnects.

What five companies do with AI feedback and evaluation

CompanyDocumented practiceWhat Flutter teams can apply
GeekyAntsIts published production-readiness review describes human review for uncertain outputs and behavior tests for an internal engineering assistant. It documents evaluation practices rather than a production Flutter voting interface.Turn reviewed feedback cases into regression tests with explicit pass criteria.
GoogleGemini users can rate a response and optionally add a reason, a comment, or previously uploaded files.Save the vote quickly and let users choose what additional context to share.
MicrosoftCopilot Studio shows positive and negative reaction trends. Users with the relevant role can inspect individual reactions and filter by commentsPair an aggregate dashboard with restricted access to individual cases.
Amazon Web ServicesAmazon Q Business’s PutFeedback API associates usefulness, reason, and comments with a conversation and message ID.Give the answer its own feedback endpoint and use structured reasons for analysis.
OpenAIChatGPT supports thumbs-up and thumbs-down feedback on individual responses. A thumbs-down can also lead to a reporting flow for safety or legal concerns.Put the controls on each answer and give serious reports their own review path.

Track coverage before drawing conclusions from ratings

Suppose a Flutter app shows 1,000 eligible answers. Users rate 100 of them, and 80 receive a helpful vote. The helpful rate among rated answers is 80%, and rating coverage is 10%. Show both figures together. To measure coverage, count each eligible response once when it is seen, even if scrolling rebuilds the message widget.

Compare feedback by feature, app version, model version, and reason code, with sample sizes visible. A rise in “missing sources” after a retrieval update gives the team a specific failure to investigate. An increase in positive ratings after moving the buttons could reflect a change in who votes.

Research by Liu, Zhang, and Choi on implicit feedback in human–LLM conversations found that what users said about a response carried more information than polarity alone for some short-question tasks, with gains failing to carry over to longer, more complex tasks in their experiments. The study examined conversational feedback, so it gives teams a reason to inspect the context behind a vote before treating the vote as a quality label.

A useful review loop starts with a repeatable failure. If users keep reporting incorrect citations, inspect the answer and retrieved sources, confirm the failure, and add it to an evaluation set. The next time the prompt, model, or retrieval pipeline changes, that test shows whether the same mistake has returned.

 

Previous articleHow to Build Subscription and Credit-Based Billing for Flutter AI Apps

LEAVE A REPLY

Please enter your comment!
Please enter your name here