buildChild method

  1. @override
Widget buildChild(
  1. BuildContext context
)

Implementation

@override
Widget buildChild(BuildContext context) {
  if (widget.cache) {
    // Flutter 3.12
    // return PopScope(
    //   onPopInvoked: (bool didPop) async {
    //     // Save the settings
    //     await apply();
    //   },
    //   child: ListView(children: widget.children),
    // );
    return WillPopScope(
      onWillPop: () async {
        // Save the settings
        await apply();
        return true;
      },
      child: ListView(children: widget.children),
    );
  }

  return ListView(children: widget.children);
}