Home > OS >  Flutter onPressed link instagram profile url with http
Flutter onPressed link instagram profile url with http

Time:04-28

How can i use my api instagram link field, when I click it, it will open the instagram page or any url?

now my widget variable giving this error
The argument type 'Null Function(dynamic)' can't be assigned to the parameter type 'void Function()'.

  IconButton(
               icon: FaIcon(FontAwesomeIcons.facebook),
               onPressed: (widget.company.social_instagram.toString()) { print("Pressed"); }
           ),

CodePudding user response:

import 'package:url_launcher/url_launcher.dart';
IconButton(
               icon: FaIcon(FontAwesomeIcons.facebook),
               onPressed: () { 
               print(widget.company.social_instagram.toString());
               launchUrl(widget.company.social_instagram.toString());
               print("Pressed"); 
}
           ),
  • Related