I am experiencing an issue in my FlutterFlow project where a persistent AppState (List JSON) is not being saved as expected. This AppState is generated through a custom action, which is triggered by a button. The action populates the app successfully and operates as intended during the session. However, the problem arises when I close the app and then reopen it; the supposed persistent variable does not retain its data.
I recreate the issue in a public project https://app.flutterflow.io/project/test-4ztdzk
Steps to Reproduce
open the project https://app.flutterflow.io/project/test-4ztdzk
press "generate JSON" button many times
restart the app and the list is empty
My custom code:
// Automatic FlutterFlow imports
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!
import 'dart:convert';
import 'package:uuid/uuid.dart';
import 'package:intl/intl.dart';
Future json() async {
FFAppState().update(() {
List<Map<String, dynamic>> item = [];
item.add({"test": "test"});
FFAppState().ItemsJson.add(item[0]);
});
print(FFAppState().ItemsJson);
}