'"The return type 'String?' isn't a 'void', as required by the closure's context."

The error I am receiving states "The return type 'String?' isn't a 'void', as required by the closure's context." the variable "_desc" is a string.

                    decoration: InputDecoration(labelText: 'Caption'),
                    validator: (value) {
                      return value!.isEmpty ? 'Description is required' : null;
                    },
                    onSaved: (value) {
                      return _desc = value;
                    },

Any help would be highly appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source