maybe property

EnergyService? get maybe

Gets the instance if already registered (safe to call from call sites that may run before/without energy registered, e.g. widget tests).

Implementation

static EnergyService? get maybe =>
    Get.isRegistered<EnergyService>() ? Get.find<EnergyService>() : null;