Created
March 5, 2018 21:44
-
-
Save anilcancakir/68e97872dc3a119b176288232050085a to your computer and use it in GitHub Desktop.
How to use dynamic home page in Flutter? - AuthService
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'dart:math'; | |
| class AuthService { | |
| // Login | |
| Future<bool> login() async { | |
| // Simulate a future for response after 2 second. | |
| return await new Future<bool>.delayed( | |
| new Duration( | |
| seconds: 2 | |
| ), () => new Random().nextBool() | |
| ); | |
| } | |
| // Logout | |
| Future<void> logout() async { | |
| // Simulate a future for response after 1 second. | |
| return await new Future<void>.delayed( | |
| new Duration( | |
| seconds: 1 | |
| ) | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment