Here is my custom function and return value is list of strings
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
// Set your action name, define your arguments and return parameter,
// and then add the boilerplate code using the green button on the right!
import 'dart:convert';
Future<List<String>> extractSubjects(String content) async {
try {
// Directly parse the content, assuming it's a JSON string.
var contentJson = jsonDecode(content);
// Extract subjects, with null safety.
String subject1 = contentJson['subject1'] ?? 'No data for subject 1';
String subject2 = contentJson['subject2'] ?? 'No data for subject 2';
String subject3 = contentJson['subject3'] ?? 'No data for subject 3';
// Return the subjects as a list.
return [subject1, subject2, subject3];
} catch (e) {
// In case of error, return a list with error message or empty strings.
return ['Error parsing content', '', ''];
}
}
I wont to be able to access every subject separately.