Selector
Multi type support Platform Selector
Basic selector
- with
selector
String result = selector(
android: 'hello Android',
ios: 'hello iOS',
fuchsia: 'hello Fuchsia',
linux: 'hello Linux',
mac: 'hello MacOS',
windows: 'hello Windows',
);
optional selector
- with
selector
String? result = optionalSelector(
android: 'hello Android',
ios: 'hello iOS',
fuchsia: 'hello Fuchsia',
);
Device selector
String result = deviceSelector(
mobile: 'hello Mobile',
desktop: 'hello Desktop',
web: 'hello Web',
);
OrElse selector
String admobKey = androidOrElse('android-key', 'iOS-key');
String iosPreferredKey = iosOrElse('iOS-key', 'android-key');
Query
print('isDesktop: $isDesktop')
print('isMobile: $isMobile')