Exception was thrown: FormatException: Invalid radix-10 number
The mistake was stupid. ♀️ I did not convert the controller to text. I directly did from controller ==> String. I am keeping this question just in case anybody else has a similar query.