Repository: flutter
Issue: Hero animation with stateful widget
Labels: c: new feature,framework,f: material design,f: routes,P3,workaround available,team-design,triaged-design

## Steps to Reproduce

is it possible to save state when using Hero animation?

1. create statefull widget, for example counter
2. wrap in on Hero widget
3. click on button to change state
4. change page
5. it's not saving state

```dart
import 'package:flutter/material.dart';

void main() => runApp(HeroApp());

class HeroApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Transition Demo',
      home: MainScreen(),
    );
  }
}

class MainScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Main Screen'),
      ),
      body: Column(
        children: <Widget>[
          Hero(
            tag: 'imageHero',
            key: ValueKey('imageHero'),
            child: HeroWidget(
              key: ValueKey('imageHero'),
            ),
          ),
          FlatButton(
              onPressed: () =>
                  Navigator.push(context, MaterialPageRoute(builder: (_) {
                    return DetailScreen();
                  })),
              child: Text('navigate'))
        ],
      ),
    );
  }
}

class HeroWidget extends StatefulWidget {
  const HeroWidget({
    Key key,
  }) : super(key: key);

  @override
  _HeroWidgetState createState() => _HeroWidgetState();
}

class _HeroWidgetState extends State<HeroWidget> {
  int count = 1;
  @override
  Widget build(BuildContext context) {
    return Container(
      child: RaisedButton(
        child: Text('clicked $count'),
        onPressed: () {
          setState(() {
            count++;
          });
        },
      ),
    );
  }
}

class DetailScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: <Widget>[
            Hero(
              tag: 'imageHero',
              child: HeroWidget(
                key: ValueKey('imageHero'),
              ),
            ),
            FlatButton(
                onPressed: () => Navigator.pop(context), child: Text('back'))
          ],
        ),
      ),
    );
  }
}

```

**Target Platform:** iOS
**Target OS version/browser:**
**Devices:** Iphone X

```
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57,
    locale en-AM)
    • Flutter version 1.12.13+hotfix.5 at /Users/narek/development/flutter
    • Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    • Android SDK at /Users/narek/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-29, build-tools 29.0.0
    • Java binary at: /Users/narek/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.3

[✓] Android Studio (version 3.5)
    • Android Studio at /Users/narek/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android
      Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • iPhone 8 • 9C589AC5-E580-4478-8D0D-2EC07550E74D • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!
```