“Tab Flutter Keepalive Otomatis” Kode Jawaban

Tab Flutter Keepalive Otomatis

Future<...> _loadingDeals;

@override
void initState() {
  _loadingDeals = loadDeals(); // only create the future once.
  super.initState();
}

@override
Widget build(BuildContext context) {
  super.build(context); // because we use the keep alive mixin.
  return new FutureBuilder(future: _loadingDeals, /* ... */);
}
Innocent Ibis

Tab Flutter Keepalive Otomatis

class _DealListState extends State<DealList> with AutomaticKeepAliveClientMixin<DealList> {
  @override
  bool get wantKeepAlive => true;

  @override
  Widget build(BuildContext context) {
    super.build(context); // need to call super method.
    return /* ... */
  }
}
Innocent Ibis

Jawaban yang mirip dengan “Tab Flutter Keepalive Otomatis”

Pertanyaan yang mirip dengan “Tab Flutter Keepalive Otomatis”

Lebih banyak jawaban terkait untuk “Tab Flutter Keepalive Otomatis” di Dart

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya