nylo-core / device-meta

This package will allow you to get the device name, model, brand, manufacturer, uuid, version, platform type and user agent.

Home Page:https://nylo.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Device Meta

pub package License: MIT

Handle device info in Flutter.

This package will allow you to get the device name, model, brand, manufacturer, uuid, version, platform type and user agent.

Getting started

Installation

Add the following to your pubspec.yaml file:

dependencies:
  device_meta: ^1.1.31

or with Dart:

dart pub add device_meta

Usage

import 'package:device_meta/device_meta.dart';

DeviceMeta deviceMeta = await DeviceMeta.init(storageKey: "exampleapp");

deviceMeta.name // iPhone
deviceMeta.model // iPhone 15 Pro
deviceMeta.brand // Apple
deviceMeta.uuid // 00000000-0000-0000-0000-000000000000
deviceMeta.version // 1.0.0
deviceMeta.platformType // iOS
deviceMeta.toJson() // { "model": "iPhone", "brand": "Apple", "manufacturer": "Apple", "uuid": "00000000-0000-0000-0000-000000000000", "version": "1.0.0", "platformType": "iOS", "userAgent": "n/a" }

You can also attach metaData to the object:

DeviceMeta deviceMeta = await DeviceMeta.init(
    storageKey: "exampleapp",
    metaData: {
        "user_id": 1,
        "app_version": "1.0.0"
    }
);

deviceMeta.metaData; // { "user_id": 1, "app_version": "1.0.0"}

Get a specific meta data value

deviceMeta.getMetaData("app_version"); // "1.0.0"

deviceMeta.getMetaData("user_id") // 1

Try the example app to see how it works.

Changelog

Please see CHANGELOG for more information what has changed recently.

Social

Licence

The MIT License (MIT). Please view the License File for more information.

About

This package will allow you to get the device name, model, brand, manufacturer, uuid, version, platform type and user agent.

https://nylo.dev

License:MIT License


Languages

Language:Dart 77.0%Language:Ruby 15.2%Language:Swift 7.4%Language:Objective-C 0.4%