Last updated:
0 purchases
platform selector
selector #
Platform Selector
Basic selector #
with if
String result = '';
if (Platform.isAndroid) result = 'hello Android';
if (Platform.isIOS) result = 'hello iOS';
if (Platform.isFuchsia) result = 'hello Fuchsia';
if (Platform.isLinux) result = 'hello Linux';
if (Platform.isMacOS) result = 'hello MacOS';
if (Platform.isWindows) result = 'hello Windows';
copied to clipboard
with selector
String result = selector(
android: 'hello Android',
ios: 'hello iOS',
fuchsia: 'hello Fuchsia',
linux: 'hello Linux',
mac: 'hello MacOS',
windows: 'hello Windows',
);
copied to clipboard
OrElse selector #
with if
String admobKey;
if (Platform.isAndroid) admobKey = 'android-key';
else admobKey = 'iOS-key';
copied to clipboard
with selector
String admobKey = androidOrElse('android-key', 'iOS-key');
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.