system_info_plus 0.0.5 copy "system_info_plus: ^0.0.5" to clipboard
system_info_plus: ^0.0.5 copied to clipboard

A flutter plugin to get device (system) info including Random access memory (RAM).

example/lib/main.dart

import 'dart:io';

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

import 'package:flutter/services.dart';
import 'package:system_info_plus/system_info_plus.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> {
  int _deviceMemory = -1;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    int deviceMemory;

    try {
      deviceMemory = await SystemInfoPlus.physicalMemory ?? -1;
    } on PlatformException {
      deviceMemory = -1;
    }
    if (!mounted) return;

    setState(() {
      _deviceMemory = deviceMemory;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('System info plugin example'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Center(
              child:
                  Text('Random Access Memory: $_deviceMemory MB (Megabytes)'),
            ),
          ],
        ),
      ),
    );
  }
}
18
likes
160
points
4.11k
downloads

Publisher

verified publishersebghatyusuf.com

Weekly Downloads

A flutter plugin to get device (system) info including Random access memory (RAM).

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on system_info_plus