Last active
June 20, 2022 15:23
-
-
Save nmaruy27/35e555657ad533aaffc0b14894155d96 to your computer and use it in GitHub Desktop.
useMemorizedを使ったGlobalKeyの生成
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HogeWidget extends HookConsumerWidget { | |
// 略 | |
@override | |
Widget build(BuildContext context, WidgetRef ref { | |
// 略 | |
final formKey = useMemorized(() => GlobalKey<FormBuilderState>()); | |
// 略 | |
return FormBuilder( | |
// 略 | |
key: formKey | |
// 略 | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment