resource_monitor 0.0.1 copy "resource_monitor: ^0.0.1" to clipboard
resource_monitor: ^0.0.1 copied to clipboard

PlatformAndroidiOS
outdated

A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:resource_monitor/resource_monitor.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> {
  Map? _data;

  @override
  void initState() {
    super.initState();
    _getResource();
  }

  Future<void> _getResource() async {
    Map data;
    try {
      data = await ResourceMonitor.getResourceUsage;
    } on PlatformException {
      throw PlatformException(
          code: 'Unknow-error', message: 'getResourceUsage');
    }
    if (!mounted) return;
    setState(() => _data = data);
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
      home: Scaffold(
          appBar: AppBar(title: const Text('Plugin example app')),
          body: Center(child: Text('Resource usage: $_data\n')),
          floatingActionButton: FloatingActionButton(
              child: const Icon(Icons.memory), onPressed: _getResource)));
}
7
likes
150
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on resource_monitor

Packages that implement resource_monitor