FFAppState Name from parameter

Custom Code

Is it possible to pass FFAppState name from widget parameter?
I tried below but it doesn't work.

What have you tried so far?
// Automatic FlutterFlow imports
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

// Set your widget name, define your parameter, and then add the
// boilerplate code using the green button on the right!

import 'package:numberpicker/numberpicker.dart';

class NumPickerWidgetfortallFilterNum2 extends StatefulWidget {
  final int initialValue;
  final int minValue;
  final int maxValue;
  final double width;
  final double height;
  final String appStateName;

  const NumPickerWidgetfortallFilterNum2({
    Key? key,
    required this.initialValue,
    required this.minValue,
    required this.maxValue,
    required this.width,
    required this.height,
    required this.appStateName,
  }) : super(key: key);

  @override
  _NumPickerWidgetfortallFilterNum2State createState() =>
      _NumPickerWidgetfortallFilterNum2State();
}

class _NumPickerWidgetfortallFilterNum2State
    extends State<NumPickerWidgetfortallFilterNum2> {
  int _currentValue = 0;

  @override
  void initState() {
    super.initState();
    _currentValue = widget.initialValue;
  }

  @override
  Widget build(BuildContext context) {
    return NumberPicker(
      value: _currentValue,
      minValue: widget.minValue,
      maxValue: widget.maxValue,
      onChanged: (value) {
        (FFAppState() as dynamic)[widget.appStateName] = value;
        setState(() => _currentValue = value);
      },
    );
  }
}
Did you check FlutterFlow's Documentation for this topic?
No
3 replies