Skip to content

Commit 34f0e5e

Browse files
authored
Removed unnecessary null guards around controller access. (#582)
1 parent 9ac37d8 commit 34f0e5e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/src/fields/form_builder_signature_pad.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class _FormBuilderSignaturePadState
138138
void initState() {
139139
super.initState();
140140
_controller = widget.controller ?? SignatureController();
141-
effectiveController.addListener(() async {
141+
_controller.addListener(() async {
142142
requestFocus();
143143
final _value = await _getControllerValue();
144144
didChange(_value);
@@ -150,22 +150,23 @@ class _FormBuilderSignaturePadState
150150
}
151151

152152
Future<Uint8List> _getControllerValue() async {
153-
return await effectiveController.toImage() != null
154-
? await effectiveController.toPngBytes()
153+
return await _controller.toImage() != null
154+
? await _controller.toPngBytes()
155155
: null;
156156
}
157157

158158
@override
159159
void reset() {
160-
effectiveController?.clear();
160+
assert(null != _controller);
161+
_controller.clear();
161162
super.reset();
162163
}
163164

164165
@override
165166
void dispose() {
166167
// Dispose the _controller when initState created it
167168
if (null == widget.controller) {
168-
effectiveController?.dispose();
169+
_controller.dispose();
169170
}
170171
super.dispose();
171172
}

0 commit comments

Comments
 (0)