Hello everyone,
I'm working on integrating Gemini AI into my FlutterFlow app using a custom action workflow, and I'm stuck on a persistent issue where my custom function isn't appearing in the action list.
The Problem:
I have a custom function named buildGeminiPrompt that compiles successfully (no red underlines or errors when I click 'Compile' in the custom code editor). However, when I go to set up an action for a button (specifically, as Action 2 after a 'Show Loading Indicator'), I cannot find buildGeminiPrompt in the list of available actions.
My callGeminiApi custom action appears correctly under Integrations > Custom Actions, but buildGeminiPrompt (which is a custom function) is nowhere to be seen, even within the Custom Actions section where I'd expect it to be if categories were merged. There is no separate "Custom Functions" category.
Code for buildGeminiPrompt:
import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '/flutter_flow/custom_functions.dart';
import '/flutter_flow/lat_lng.dart';
import '/flutter_flow/place.dart';
import '/flutter_flow/uploaded_file.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/auth/firebase_auth/auth_util.dart';
String? buildGeminiPrompt(
String? topic,
bool isParagraph,
bool isBulletPoint,
String? selectedTone,
String? outputLength,
String? targetLanguage,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
String format = "";
if (isParagraph) {
format = "in paragraph format";
} else if (isBulletPoint) {
format = "in bullet point format";
}
String prompt =
"Write a ${outputLength!.toLowerCase()} piece of content $format about the topic: \"$topic\".";
if (selectedTone!.isNotEmpty) {
prompt += " The tone should be $selectedTone.";
}
if (targetLanguage!.isNotEmpty && targetLanguage != "English") {
prompt += " Write it in $targetLanguage.";
}
prompt += " Ensure the content is original and engaging.";
return prompt;
/// MODIFY CODE ONLY ABOVE THIS LINE
}