• Michael Goderbauer's avatar
    Restoration Framework (#60375) · 175e5c9a
    Michael Goderbauer authored
    * state restoration
    
    * added example
    
    * typos and analyzer
    
    * whitespace
    
    * more typos
    
    * remove unnecessary import
    
    * whitespace
    
    * fix sample code
    
    * tests for restorationmanager and restorationid
    
    * ++
    
    * typo
    
    * tests for bucket, part1
    
    * rename tests
    
    * more tests
    
    * finished tests for service layer
    
    * remove wrong todo
    
    * ++
    
    * review comments
    
    * tests for Unmanaged and regular scope
    
    * RootRestorationScope tests
    
    * typo
    
    * whitespace
    
    * testing framework
    
    * tests for properties
    
    * last set of tests
    
    * analyzer
    
    * typo
    
    * dan review
    
    * whitespace
    
    * ++
    
    * refactor finalizers
    
    * ++
    
    * ++
    
    * dispose guard
    
    * ++
    
    * ++
    
    * dan review
    
    * add manager assert
    
    * ++
    
    * analyzer
    
    * greg review
    
    * fix typo
    
    * Ian & John review
    
    * ian review
    
    * RestorationID -> String
    
    * revert comment
    
    * Make primitives non-nullable in prep for NNBD
    175e5c9a
restoration.dart 797 Bytes
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.8

import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

export '../services/restoration.dart';

class BucketSpy extends StatefulWidget {
  const BucketSpy({Key key, this.child}) : super(key: key);

  final Widget child;

  @override
  State<BucketSpy> createState() => BucketSpyState();
}

class BucketSpyState extends State<BucketSpy> {
  RestorationBucket bucket;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    bucket = RestorationScope.of(context);
  }

  @override
  Widget build(BuildContext context) {
    return widget.child ?? Container();
  }
}