Umakanth Pendyala
Umakanth Pendyala

Reputation: 335

Is there any way i can get the name of the user of the phone(android) in flutter app?

Guys I am trying to get the name of the user who uses the phone. Is there any flutter plugin which can provide me this functionality

Upvotes: 3

Views: 1485

Answers (1)

Mouaad
Mouaad

Reputation: 191

Hello you can use this plugin device_info, you can see the documentation about it here : https://pub.dev/packages/device_info#-example-tab-

import 'package:device_info/device_info.dart';

void getDeviceinfo() async {
  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); 
  AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo; // instantiate Android Device Information
  IosDeviceInfo iosInfo = await deviceInfo.iosInfo; // instantiate IOS Device Information
  print("for Android : ${androidDeviceInfo.product}");
  print("for IOS : ${iosInfo.name}");
}

Upvotes: 4

Related Questions