integrate_platform 1.0.2 copy "integrate_platform: ^1.0.2" to clipboard
integrate_platform: ^1.0.2 copied to clipboard

Cross-platform [Platform] and File Management Just use [IntegratePlatform].

example/main.dart

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  String data = 'None';
  String path = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(IntegratePlatform.operatingSystemVersion)),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          Text(data),
          ElevatedButton(
            child: const Text("Write to File"),
            onPressed: () async {
              final result =
                  await IntegratePlatform.writeFile("hello world", "hello.txt");
              path = result.path.toString();
              setState(() {});
            },
          ),
          Text(path),
          ElevatedButton(
            child: const Text("Read a File"),
            onPressed: () async {
              final result = await IntegratePlatform.readFile();
              if (result.success) {
                data = result.content.toString();
                setState(() {});
              }
            },
          ),
        ],
      ),
    );
  }
}
1
likes
150
pub points
28%
popularity

Publisher

verified publisheralfiey.me

Cross-platform [Platform] and File Management Just use [IntegratePlatform].

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

file_picker, flutter, path_provider

More

Packages that depend on integrate_platform