Created
May 14, 2020 22:01
-
-
Save chunhtai/afa5e15eb1c0ba4829527ae185a9d780 to your computer and use it in GitHub Desktop.
This file contains 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'; | |
void main() { | |
Tester a = Tester(); | |
a.test(); | |
} | |
class Tester { | |
Object _currentRouterDelegateTransaction; | |
void test() { | |
print('begin transaction $_currentRouterDelegateTransaction'); | |
_createFuture() | |
.then<void>(_verifyRouteNameParserStillCurrent) | |
.then<void>(_verifyRouterDelegateStillCurrent(_currentRouterDelegateTransaction)) | |
.then<void>((void data) { | |
print('should not reach here'); | |
}); | |
} | |
Future<void> _createFuture() { | |
return Future<void>.value(null); | |
} | |
Future<void> _verifyRouteNameParserStillCurrent(void data) { | |
_currentRouterDelegateTransaction = Object(); | |
return Future<void>.value(); | |
} | |
Function _verifyRouterDelegateStillCurrent(Object transaction) { | |
return (void data) { | |
// this should fail. | |
assert (transaction == _currentRouterDelegateTransaction); | |
return Future<void>.value(); | |
}; | |
} | |
} | |
typedef _AsyncPassthrough<Q> = Future<Q> Function(Q); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment