ios_machine_to_model 1.2.0

Flutter Android iOS web

A Flutter package to translate ios machine code to model. The machine code is retrieved using device_info plugin.

example/lib/main.dart

import 'dart:io';

import 'package:device_info/device_info.dart';
import 'package:flutter/material.dart';
import 'package:ios_machine_to_model/ios_machine_to_model.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ios_machine_to_model_example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  String _model;

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

    _getModel();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Package ios_machine_to_model example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Your device model is: $_model',
            ),
          ],
        ),
      ),
    );
  }

  _getModel() async {
    if (Platform.isAndroid) {
      _model = 'Android';

      return;
    }

    DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
    IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
    _model = iosMachineToModel(iosInfo.utsname.machine);
  }
}
1
likes
110
pub points
39%
popularity

Publisher

jitao.tech

A Flutter package to translate ios machine code to model. The machine code is retrieved using device_info plugin.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on ios_machine_to_model