app_management 0.0.1-dev.3 copy "app_management: ^0.0.1-dev.3" to clipboard
app_management: ^0.0.1-dev.3 copied to clipboard

Close Other App, Run Other App And Much more for android

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:app_management/app_management.dart';
import 'package:flutter/services.dart';

import 'memory.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();
    Future.delayed(Duration.zero, () {
      SystemChrome.setSystemUIOverlayStyle(
        SystemUiOverlayStyle(
          statusBarColor: Colors.transparent,
          statusBarIconBrightness: Brightness.light,
        ),
      );
      // Clipboard.setData(ClipboardData(text: json.encode({"testing": "test"})));
    });
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      final app = await AppManagement.getInstalledApps();
      platformVersion = app.first.name ?? ''; //(await AppManagement.runInstalledApp(app[1].packageName!)).toString();
    } catch (_) {
      print(_);
      platformVersion = 'Failed to get Memory Info.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MemmoryUI(),
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Close Other App, Run Other App And Much more for android

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on app_management