simple_platform 1.0.1 copy "simple_platform: ^1.0.1" to clipboard
simple_platform: ^1.0.1 copied to clipboard

Provides two classes to determine the application platform and the device platform.

example/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Text(
              'AppPlatform.currentPlatform: '
              '${AppPlatform.currentPlatform}',
              textAlign: TextAlign.center,
            ),
            Text(
              'DevicePlatform.currentPlatform: '
              '${DevicePlatform.currentPlatform}',
              textAlign: TextAlign.center,
            ),
          ],
        ),
      ),
    );
  }
}
10
likes
160
points
861
downloads

Publisher

unverified uploader

Weekly Downloads

Provides two classes to determine the application platform and the device platform.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on simple_platform