Add assert for mutually exclusive errorBuilder and errorText (#183901)
This PR fixes a framework crash that occurs when `errorBuilder` is used
alongside an `InputDecoration` that contains an `errorText`.
Because `InputDecoration.copyWith` ignores `null` values, attempting to
clear the `errorText` dynamically during the build phase leaves the
decoration with both properties defined, triggering a late assertion in
`InputDecorator`.
Following the architectural guidance provided by @Hari-07 in PR #183384,
this fix enforces mutual exclusivity at the constructor level. It adds
an `assert` to both `TextFormField` and `DropdownButtonFormField` to
ensure developers fail fast if both properties are provided.
Fixes #183378
I added the following tests to verify the assertions:
- `TextFormField` asserts when both `errorBuilder` and
`decoration.errorText` are provided.
- `DropdownButtonFormField` asserts when both `errorBuilder` and
`decoration.errorText` are provided.
---------
Co-authored-by: Hari07 <22373191+Hari-07@users.noreply.github.com>
4 files changed