# Lifecycle constructor | |
*[<Null safety>](https://dart.dev/null-safety)* | |
Lifecycle() | |
<p>Obtains an instance of the shared <a href="../../package-fuchsia_modular_lifecycle/Lifecycle-class.md">Lifecycle</a> instance.</p> | |
## Implementation | |
```dart | |
factory Lifecycle() { | |
if (_singleton == null) { | |
throw Exception( | |
'Attempted to construct Lifecycle before lifecycle events have been enabled. ' | |
'Ensure that Lifecycle.enableLifecycleEvents is called first.'); | |
} | |
return _singleton!; | |
} | |
``` | |