blob: 20c42cf6f1ccd707f7d6315dfe2f3f03153875b9 [file] [log] [blame]
// 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_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
class TestUniqueWidget extends UniqueWidget<TestUniqueWidgetState> {
const TestUniqueWidget({ GlobalKey<TestUniqueWidgetState> key }) : super(key: key);
TestUniqueWidgetState createState() => TestUniqueWidgetState();
class TestUniqueWidgetState extends State<TestUniqueWidget> {
Widget build(BuildContext context) => Container();
void main() {
testWidgets('Unique widget control test', (WidgetTester tester) async {
final TestUniqueWidget widget = TestUniqueWidget(key: GlobalKey<TestUniqueWidgetState>());
await tester.pumpWidget(widget);
final TestUniqueWidgetState state = widget.currentState;
expect(state, isNotNull);
await tester.pumpWidget(Container(child: widget));
expect(widget.currentState, equals(state));