title: Invalid double-flutter
body: <p>i Make a Form and I need to validate and save it when pressed.
  so when i Press the Save Button i got this error:
  ════════ Exception caught by gesture ═══════════════════════════════════════════
  The following FormatException was thrown while handling a gesture:
  Invalid double
  i tried double.tryParse() instead of double.parse() also i try to put in quotation.</p>
  <p>i will mention where i got this error in the code below and Thank You for any help.</p>
  <pre><code>class EditProductScreen extends StatefulWidget {
  
  const EditProductScreen({Key? key}) : super(key: key);
  
  @override
  State&lt;EditProductScreen&gt; createState() =&gt; _EditProductScreenState();
  }
  
  
  class _EditProductScreenState extends State&lt;EditProductScreen&gt; {
  
  final _form = GlobalKey&lt;FormState&gt;();
  var product = Product(
  id: '',
  title: '',
  price: 0.0,
  imageUrl: '',
  description: '',
  );
  
   void _saveForm() {
  _form.currentState?.validate();
  _form.currentState?.save();
  }
  
  @override
  Widget build(BuildContext context) {
   return Scaffold(
    appBar: AppBar(
      title: const Text('Edit/Add Products'),
      actions: [
        IconButton(
          onPressed: _saveForm,
          icon: const Icon(Icons.save),
        ),
      ],
    ),
    body: Padding(
      padding: const EdgeInsets.all(16.0),
      child: Form(
        key: _form,
        child: ListView(
          children: [
           
            TextFormField(
              decoration: const InputDecoration(
                hintText: 'Price',
                labelText: 'Price',
              ),
              textInputAction: TextInputAction.next,
              keyboardType: TextInputType.number,
  </code></pre>
  <p>Here Is The Error</p>
  <pre><code>            onSaved: (value) {
                product = Product(
                  id: '',
                  title: product.title,
                  price:double.parse(value!),
                  imageUrl: product.imageUrl,
                  description: product.description,
                );
              },
              validator: (value) {
                if (value!.isEmpty) {
                  return 'PLease insert a price';
                }
  
                if (double.tryParse(value)! &lt;= 0.0) {
                  return 'Please insert a value great than 0';
                }
                if (double.tryParse(value) == null) {
                  return 'Please enter a Valid number';
                } else {
                  return null;
                }
              },
            ),
           
          
  </code></pre>