instance property

FlutterGpiod instance

Gets the global instance of FlutterGpiod.

If none exists, one will be constructed.

Implementation

static FlutterGpiod get instance {
  if (_instance == null) {
    final chips =
        List.generate(PlatformInterface.instance.getNumChips(), (i) => GpioChip._fromIndex(i), growable: false);

    final bias = PlatformInterface.instance.supportsBias();
    final reconfig = PlatformInterface.instance.supportsLineReconfiguration();

    _instance = FlutterGpiod._internal(List.unmodifiable(chips), bias, reconfig);
  }

  return _instance!;
}