withTransition<T> static method
Wraps an async navigation operation with transition notifications.
Example:
await CNTransitionHelper.withTransition(() async {
await Navigator.of(context).pushNamed('/details');
});
Implementation
static Future<T> withTransition<T>(Future<T> Function() operation) async {
await beginTransition();
try {
return await operation();
} finally {
// Delay end to allow animation to complete
Future.delayed(const Duration(milliseconds: 350), endTransition);
}
}