Repository: flutter
Issue: Reactivate a timer after navigator.push and navigator.pop
Labels: framework,dependency: dart,c: proposal,P3,team-framework,triaged-framework

I have a timer that updates a counter when a widget is visible. I want to cancel the timer with a navigator.push. 

init state is only called at startup. As espected.
deactivate is called on navigator.push (this is where I can cancel my timer)
dispose is never called

How can reactivate after a navigate.pop. because there is no `activate` method in the State widget. only a deactivate. This is very strange for my.

This is my current sollution

```
import 'dart:async';

import 'package:flutter/material.dart';

class Test extends StatefulWidget {
  @override
  _TestState createState() => _TestState();
}

class _TestState extends State<Test> {
  var counter = 0;
  Timer _timer;

  @override
  void initState() {
    super.initState();
    _setTimer();
  }

  @override
  void deactivate() {
    print('DEACTIVATE');
    if (_timer.isActive) {
      _timer.cancel();
    } else {
      _setTimer();
    }
    super.deactivate();
  }

  @override
  Widget build(BuildContext context) {
    return Text(counter.toString());
  }

  void _setTimer() {
    _timer = Timer.periodic(const Duration(seconds: 1), (timer) {
      setState(() {
        counter++;
      });
    });
  }
}
```

This is what I want
```
import 'dart:async';

import 'package:flutter/material.dart';

class Test extends StatefulWidget {
  @override
  _TestState createState() => _TestState();
}

class _TestState extends State<Test> {
  var counter = 0;
  Timer _timer;

  @override
  void initState() {
    super.initState();
    _setTimer();
  }

  @override
  void activate() {
    _setTimer();
  }

  @override
  void deactivate() {
    print('DEACTIVATE');
    _timer.cancel();
    super.deactivate();
  }

  @override
  Widget build(BuildContext context) {
    return Text(counter.toString());
  }

  void _setTimer() {
    _timer = Timer.periodic(const Duration(seconds: 1), (timer) {
      setState(() {
        counter++;
      });
    });
  }
}

```


**Target Platform:** IOS/ANDROID
**Target OS version/browser:** Any 
**Devices:** Simulator/Device

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel unknown, v1.12.13+hotfix.5, on Mac OS X 10.15.1 19B88, locale en-BE)
    • Flutter version 1.12.13+hotfix.5 at /Users/vanlooverenkoen/flutter
    • Framework revision 27321ebbad (4 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.2)
    • Android SDK at /Users/vanlooverenkoen/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/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.7.5

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/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 not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • iPhone 11 Pro Max • F2704E51-185C-4E5F-BC54-8FB1BA3C43BE • ios            • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
    • macOS             • macOS                                • darwin-x64     • Mac OS X 10.15.1 19B88
    • Chrome            • chrome                               • web-javascript • Google Chrome 78.0.3904.108
    • Web Server        • web-server                           • web-javascript • Flutter Tools

! Doctor found issues in 1 category.
```