Skip to content

frozenrainyoo/selector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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';
  • with selector
String result = selector(
      android: 'hello Android',
      ios: 'hello iOS',
      fuchsia: 'hello Fuchsia',
      linux: 'hello Linux',
      mac: 'hello MacOS',
      windows: 'hello Windows',
);

OrElse selector

  • with if
String admobKey;
if (Platform.isAndroid) admobKey = 'android-key';
else admobKey = 'iOS-key';
  • with selector
String admobKey = androidOrElse('android-key', 'iOS-key');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 69.2%
  • Ruby 21.6%
  • Swift 6.5%
  • Kotlin 2.1%
  • Objective-C 0.6%