useSnapshotController function
Creates and disposes a SnapshotController.
Note that allowSnapshotting must be set to true
in order for this controller to actually do anything.
This is consistent with SnapshotController.new.
If allowSnapshotting changes on subsequent calls to useSnapshotController,
SnapshotController.allowSnapshotting will be called to update accordingly.
final controller = useSnapshotController(allowSnapshotting: true);
// is equivalent to
final controller = useSnapshotController();
controller.allowSnapshotting = true;
See also:
Implementation
SnapshotController useSnapshotController({
bool allowSnapshotting = false,
}) {
return use(
_SnapshotControllerHook(
allowSnapshotting: allowSnapshotting,
),
);
}