flutter_device_friendly_name 0.1.0 copy "flutter_device_friendly_name: ^0.1.0" to clipboard
flutter_device_friendly_name: ^0.1.0 copied to clipboard

Retrieve a friendly name for the current device.

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _friendlyName = 'Loading...';

  @override
  void initState() {
    super.initState();
    FlutterDeviceFriendlyName.friendlyName.then((x) {
      setState(() {
        _friendlyName = x; 
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Device name: $_friendlyName\n'),
        ),
      ),
    );
  }
}
1
likes
30
pub points
3%
popularity

Publisher

unverified uploader

Retrieve a friendly name for the current device.

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_device_friendly_name