Update page state variable with custom action

Hey everyone.

Hope anybody will be able to help me 😄

I want to pass a string to a local page state variable which is a string<list>.

I tried making the custom action using the code co-pilot and it gave me the following code:

// Automatic FlutterFlow imports

import '/backend/backend.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!

Future addStringToPageStateList(

List<String> pageStateList,

String pageStateString,

) async {

// add string to set, page state list

pageStateList.add(pageStateString);

}

However the custom action doesn't add the string to the page state list.

2 replies