deviceSelector<T> function
T
deviceSelector<T>({
- required T mobile,
- required T desktop,
- required T web,
deviceSelector
String result = deviceSelector(
mobile: 'hello Mobile',
desktop: 'hello Desktop',
web: 'hello Web'
);
Implementation
T deviceSelector<T>({
required T mobile,
required T desktop,
required T web,
}) {
if (kIsWeb) return web;
if (isMobile) return mobile;
if (isDesktop) return desktop;
throw 'Unidentified device ${Platform.operatingSystem}';
}