Skip to content

Commit

Permalink
fix: FormRef.select is now non-nullable.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Aug 22, 2023
1 parent b226ac8 commit 7e27253
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/masamune/lib/form/form_scoped_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ class FormRef implements WidgetRef {
/// When a value is being added to a form, [onAdd] is executed; when editing, [onEdit] is executed.
///
/// フォームに値を追加しているときは[onAdd]が実行され、編集しているときは[onEdit]が実行されます。
T? select<T>({T Function()? onAdd, T Function(String? editId)? onEdit}) {
T select<T>({
required T Function() onAdd,
required T Function(String? editId) onEdit,
}) {
if (isAdding) {
return onAdd?.call();
return onAdd.call();
} else {
return onEdit?.call(editId);
return onEdit.call(editId);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/masamune/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ packages:
path: "../katana_form"
relative: true
source: path
version: "2.6.1"
version: "2.7.0"
katana_functions:
dependency: "direct main"
description:
Expand Down

0 comments on commit 7e27253

Please sign in to comment.