How do I open a web browser (URL) from my Flutter code?

 

Flutter have a plugin for launching a URL in the mobile platform url_launcher

Read More about Webview and javascript events

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


void main() {
  runApp(
Scaffold(
  backgroundColor: Colors.grey,
  appBar: AppBar(
    backgroundColor: Colors.deepPurple,
    title: Text("Webview Examples"),
  ),
  body: Container(
    margin: EdgeInsets.all(20),
    child: RaisedButton(
      padding: EdgeInsets.all(12),
      child: Text("Browser",style: TextStyle(
          color: Colors.white,fontSize: 18
      )),
      color: Colors.red,
      shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(15)
      ),
      onPressed: () {
        _launchURL("http://rrtutors.com/");
      },
    ),
  ),
)
);
}

_launchURL() async {
  const url = 'https://flutter.io';
  if (await canLaunch(url)) {
    await launch(url);
  } else {
    throw 'Could not launch $url';
  }
}

 

Other Flutter Examples