Skip to content

Commit

Permalink
[connectivity] Update README.md (flutter#1201)
Browse files Browse the repository at this point in the history
Fixed sample code in README.md.
  • Loading branch information
tarekbazine authored and Chris Yang committed Mar 7, 2019
1 parent 87e2bdc commit 5bea35b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/connectivity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ exposed by connectivity plugin:
```dart
import 'package:connectivity/connectivity.dart';
@override
initState() {
super.initState();
subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
// Got a new connectivity status!
})
}
// Be sure to cancel subscription after you are done
@override
dispose() {
super.dispose();
subscription.cancel();
}
```
Expand Down

0 comments on commit 5bea35b

Please sign in to comment.