class App { val analytics by lazy { // assume some heavy initialization FirebaseAnalytics.getInstance(App.application) } fun testAnalytics() { // analytics is only initialized once and store in variable for subsequent call analytics.logEvent("Hello", null) analytics.logEvent("Hello again", null) }}
NOTE: Reference Lazy - By default, the evaluation of lazy properties is synchronized.