Convert String To Integer (Custom Function)

I need in function "Convert String To Integer" for Slider in Form (send data from slider to document field). Slider returns value in String format.

Please give me correct code.

I use similar function like here: https://docs.flutterflow.io/widgets-and-components/widgets/form-elements-1/slider#2.-creating-a-custom-function-to-convert-string-to-int

import 'dart:math' as math;

int convertStringToInt(String someString) {
  // string to int
  int tries;

  if (someString == null) {
    return 0;
  }

  try {
    tries = int.parse(someString);
  } catch (err) {
    return 0;
  }

  return tries;
}

Test doesn't work (input: 52, output: null)

FF offer "source". What does in mean?

tries = int.parse(source: someString);

Screen

1
2 replies