device_vendor_info 1.0.0 copy "device_vendor_info: ^1.0.0" to clipboard
device_vendor_info: ^1.0.0 copied to clipboard

Get hardware information (BIOS, Motherboard and System) into Flutter platform.

Hardware information getter in Flutter environment #

Pub Version

This package offers additional hardware informations regarding on BIOS, motherboard and system that it enables software to allow/restrict features to specific vendors.

Usages #

Install dependencies #

In pubspec.yaml:

dependencies:
    device_vendor_info: # Version constraint

Import & implementation #

import 'package:device_vendor_info/device_vendor_info.dart';
import 'package:flutter/widgets.dart';

Future<void> main() async {
    WidgetsFlutterBinding.ensureInitialized();

    final bios = await getBiosInfo();
    print(bios.vendor);
}

Testing #

To run testes with DeviceVendorInfo, overrideCorrectTargetPlatform must be invoked in setUpAll before all testes. Then, attach MockDeviceVendorInfoLoader into DeviceVendorInfo.instance. Otherwise the incoming testes will throws UnsupportedError immediately.

// Specify testing platform to prevent causing test failed when running on unsupport platform accidentally.
@TestOn("windows || mac-os || linux")

import 'package:device_vendor_info/device_vendor_info.dart';
import 'package:device_vendor_info/instance.dart' show DeviceVendorInfo;
import 'package:device_vendor_info/testing.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
    setupAll(() {
        // Call it first
        overrideCorrectTargetPlatform();

        // Change the instance to mock loader instead of automatically uses produtive loader.
        DeviceVendorInfo.instance = MockDeviceVendorInfoLoader(
          BiosInfo(vendor: "Generic vendor", version: "v1.23", releaseDate: DateTime(2023, 2, 21)),
          BoardInfo(manufacturer: "Default", productName: "", version: ""),
          SystemInfo(family: "",manufacturer: "",productName: "",version: "")
        );
    });
    test("Run test", () {
        // Test implementations here
    });
    testWidget("Run test with widget", (tester) async {
        // Test with Flutter widget
    });
}

License #

BSD-3

1
likes
140
pub points
41%
popularity

Publisher

verified publisherrk0cc.xyz

Get hardware information (BIOS, Motherboard and System) into Flutter platform.

Repository (GitHub)
View/report issues

Topics

#hardware #device #bios

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

BSD-3-Clause (LICENSE)

Dependencies

device_vendor_info_interface, device_vendor_info_unix, device_vendor_info_windows, flutter, meta

More

Packages that depend on device_vendor_info