usePlatform method
void
usePlatform(
- BuildContext context, {
- T android(
- T
- T iOS(
- T
- T fuchsia(
- T
- T linux(
- T
- T macOS(
- T
- T windows(
- T
- T web(
- T
Implementation
void usePlatform(
BuildContext context, {
T Function(T)? android,
T Function(T)? iOS,
T Function(T)? fuchsia,
T Function(T)? linux,
T Function(T)? macOS,
T Function(T)? windows,
T Function(T)? web,
}) {
fallback(T Function(T)? builder) {
if (builder != null) builder(self);
}
if (kIsWeb)
fallback(web);
else
switch (Theme.of(context).platform) {
case TargetPlatform.android:
fallback(android);
break;
case TargetPlatform.iOS:
fallback(iOS);
break;
case TargetPlatform.fuchsia:
fallback(fuchsia);
break;
case TargetPlatform.linux:
fallback(linux);
break;
case TargetPlatform.macOS:
fallback(macOS);
break;
case TargetPlatform.windows:
fallback(windows);
break;
}
}