platform_plus 4.8.0 copy "platform_plus: ^4.8.0" to clipboard
platform_plus: ^4.8.0 copied to clipboard

Platform Plus is a package for easily figuring out information about the platform your code is running on

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:platform_plus/platform_plus.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await PlatformPlus.platform.init();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'platform_plus_example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('platform_plus_example'),
        ),
        body: SingleChildScrollView(
          padding: const EdgeInsets.symmetric(vertical: 40),
          child: Center(
            child: Column(
              children: [
                Text(
                  'isAndroidNative: ${PlatformPlus.platform.isAndroidNative}',
                ),
                Text('isAndroidWeb: ${PlatformPlus.platform.isAndroidWeb}'),
                Text('isIOSNative: ${PlatformPlus.platform.isIOSNative}'),
                Text('isIOSWeb: ${PlatformPlus.platform.isIOSWeb}'),
                Text(
                  'isWindowsNative: ${PlatformPlus.platform.isWindowsNative}',
                ),
                Text('isWindowsWeb: ${PlatformPlus.platform.isWindowsWeb}'),
                Text('isMacOSNative: ${PlatformPlus.platform.isMacOSNative}'),
                Text('isMacOSWeb: ${PlatformPlus.platform.isMacOSWeb}'),
                Text('isLinuxNative: ${PlatformPlus.platform.isLinuxNative}'),
                Text('isLinuxWeb: ${PlatformPlus.platform.isLinuxWeb}'),
                Text(
                  'isFuschiaNative: ${PlatformPlus.platform.isFuschiaNative}',
                ),
                Text('isFuschiaWeb: ${PlatformPlus.platform.isFuschiaWeb}'),
                Text(
                  'supportsFirebase: ${PlatformPlus.platform.supportsFirebase}',
                ),
                Text('isUnitTest: ${PlatformPlus.platform.isUnitTest}'),
                Text(
                  'isPhysicalDevice: ${PlatformPlus.platform.isPhysicalDevice}',
                ),
                Text(
                  'androidVersionCode: ${PlatformPlus.platform.androidVersionCode}',
                ),
                Text('iosVersion: ${PlatformPlus.platform.iosVersion}'),
                Text('iosDevice: ${PlatformPlus.platform.iosDevice.name}'),
                Text('isTestFlight: ${PlatformPlus.platform.isTestFlight}'),
                Text('webRenderer: ${PlatformPlus.platform.webRenderer.name}'),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
13
likes
0
pub points
82%
popularity

Publisher

verified publisherrexios.dev

Platform Plus is a package for easily figuring out information about the platform your code is running on

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

device_info_plus, flutter, package_info_plus, web

More

Packages that depend on platform_plus