platform_specific 1.0.0 copy "platform_specific: ^1.0.0" to clipboard
platform_specific: ^1.0.0 copied to clipboard

Package that simplifies handling platform-specific operations and callbacks in your Dart/Flutter applications.

example/main.dart

// ignore_for_file: avoid_print

import 'package:platform_specific/platform_specific.dart';

void main(List<String> args) {
  final myValue = Platforms.on<String>(
    {
      PlatformTypes.android: () {
        return '🤖';
      },
      PlatformTypes.windows: () {
        return '🪟';
      },
      PlatformTypes.oneOf([PlatformTypes.iOS, PlatformTypes.macOS]): () {
        return '🍎';
      }
    },
    orElse: () {
      return 'unknown';
    },
  );

  print(myValue);
}

class MyCustomPlatform extends PlatformType {
  const MyCustomPlatform();

  @override
  // here you can test for your specific platform.
  bool isPlatform(PlatformType? override) => true;
}
5
likes
160
pub points
0%
popularity

Publisher

verified publisherclevertasks.de

Package that simplifies handling platform-specific operations and callbacks in your Dart/Flutter applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

universal_platform

More

Packages that depend on platform_specific