Natural Language Desktop App – FlutterFlow

  1. Home
  2. Docs
  3. Selling on Momensity Marketplace
  4. Natural Language Desktop App – FlutterFlow

Here’s a basic tutorial for creating a desktop application using FlutterFlow and integrating ChatGPT API:


Sign up for FlutterFlow and create a new project.


Create a new screen by clicking on the plus icon in the left sidebar and selecting “Screen”. Give your screen a name (e.g. “Chat Screen”) and select “Desktop” as the platform.


Add a text input and a button widget to your screen. These will be used to input text and send messages to the ChatGPT API.


Create a new API key on the ChatGPT website.


In FlutterFlow, create a new HTTP request service by clicking on the plus icon in the left sidebar and selecting “HTTP Request”. Give your service a name (e.g. “ChatGPT API”) and enter the URL for the ChatGPT API endpoint, along with the API key you created in step 4.


In the “Request” section of your HTTP request service, select “POST” as the method and enter the following JSON data:

"model": "text-generation",
"prompt": "{{input.text}}"

This JSON data will be sent to the ChatGPT API with the text input from your app.


In the “Response” section of your HTTP request service, select “JSON” as the format and enter the following JSON path:


This JSON path will extract the generated text from the ChatGPT API response.

In your screen’s code editor, create a new function that will be called when the button is pressed. This function should call your HTTP request service and display the generated text in a new widget (e.g. a text label).

Here’s an example implementation:

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';

class ChatScreen extends StatefulWidget {
  _ChatScreenState createState() => _ChatScreenState();

class _ChatScreenState extends State<ChatScreen> {
  TextEditingController inputController = TextEditingController();
  String outputText = "";

  Future<void> generateText() async {
    String apiUrl = "";
    String apiKey = "YOUR_API_KEY_HERE";
    String promptText = inputController.text;

    var response = await, headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer $apiKey"
    }, body: jsonEncode({
      "model": "text-generation",
      "prompt": promptText

    var responseData = jsonDecode(response.body);
    String generatedText = responseData["choices"][0]["text"];

    setState(() {
      outputText = generatedText;

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Chat Screen"),
      body: Center(
        child: Column(
          children: [
              controller: inputController,
              decoration: InputDecoration(
                hintText: "Enter your message here"
            SizedBox(height: 20),
              onPressed: generateText,
              child: Text("Send"),
            SizedBox(height: 20),

Note: Remember to replace “YOUR_API_KEY_HERE” with your ChatGPT API key.

It’s essential to ensure that you have all the necessary legal agreements and licenses in place for the sale of the desktop app and that you comply with Momensity marketplace’s terms and conditions. It’s also a good idea to provide customer support for the app to help ensure customer satisfaction and reduce the likelihood of refund requests or negative reviews.

Was this article helpful to you? Yes No

How can we help?