import 'dart:developer';

import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class MyInAppBrowser extends InAppBrowser {
  final Function onExitCallback;
  final Function(String) onLoadStartCallback;

  MyInAppBrowser({
    required this.onExitCallback,
    required this.onLoadStartCallback,
  });

  @override
  Future onBrowserCreated() async {
    log("\n\nBrowser Created!\n\n");
  }

  @override
  Future onLoadStart(Uri? url) async {
    onLoadStartCallback(url.toString());
  }

  @override
  Future onLoadStop(Uri? url) async {
    log("\n\nStopped $url\n\n");
  }

  @override
  void onLoadError(Uri? url, int code, String message) {
    log("Can't load $url.. Error: $message");
  }
}
