Search code examples
flutterflutter-layoutflutter-widget

Radomly pick a number from contacts and call in flutter?


When user click or touch the button, the application will randomly pick a number from user's phone contact list and call. I see this kind of app from google play store but I was wondering if it is possible to create one like this with flutter?

If yes, are there any resources I can look into? Thanks in advance


Solution

  • Yes, it's possible.

    1. How to get phone numbers?

    You can look in pub.dev, the official package repository for Dart and Flutter apps. Search for "get phone contact". Pick one package, then use it to get the contact list.

    2. You got the list, how to randomly pick a number from the list?

    Google "dart get random element from list" and click the first stack overflow link you see.

    3. You got the number, how to make the phone call?

    Repeat step number 1.