adaptivePlatformDensity property Null safety

VisualDensity adaptivePlatformDensity

Returns a visual density that is adaptive based on the defaultTargetPlatform.

For desktop platforms, this returns compact, and for other platforms, it returns a default-constructed VisualDensity.

Implementation

static VisualDensity get adaptivePlatformDensity {
  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
    case TargetPlatform.iOS:
    case TargetPlatform.fuchsia:
      break;
    case TargetPlatform.linux:
    case TargetPlatform.macOS:
    case TargetPlatform.windows:
      return compact;
  }
  return VisualDensity.standard;
}