deviceType property

TargetDeviceType get deviceType

The current target device type (phone vs desktop design target).

Triggers a rebuild if the configuration changes (rare).

Implementation

TargetDeviceType get deviceType {
  // We listen to breakpoint aspect since device type categorization
  // is tied to screen dimension categories.
  final data = FlexiInheritedWidget.of(_context, aspect: FlexiAspect.breakpoint);
  if (data == null) {
    throw FlutterError(
        'FlexiConfig not found in context. Make sure to wrap your app with FlexiConfig.');
  }
  return data.deviceTypeConfig.targetDeviceType;
}