darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
190 stars 123 forks source link

The method 'webInitialize' isn't defined for the class 'FacebookAuth'. #349

Closed jstdk closed 10 months ago

jstdk commented 10 months ago

What version are you using?

flutter_facebook_auth: ^5.0.11

What OS and version are you using to local deploy your application?

Linux Mint 21.1

What platforms are you seeing the problem on?

web

pubspec.yaml

publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
    sdk: '>=3.0.2 <4.0.0'
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  supabase_flutter: ^1.10.1
  local_auth: ^2.1.6
  font_awesome_flutter: ^10.4.0
  flutter_dotenv: ^5.1.0
  responsive_framework: ^1.0.0
  shared_preferences: ^2.1.0
  provider: ^6.0.5
  image_picker: ^0.8.7+4
  email_validator: ^2.1.16
  system_theme: ^2.1.0
  flutter_native_splash: ^2.2.0
  cupertino_icons: ^1.0.5
  circle_flags: ^1.0.4
  flutter_html: ^3.0.0-alpha-7
  file_picker: ^5.2.1
  quill_html_editor: ^2.1.8
  flutter_widget_from_html: ^0.10.1
  url_launcher: ^6.1.10
  jiffy: ^6.2.1
  uuid: ^3.0.6
  file_saver: ^0.2.4
  gif_view: ^0.3.1
  video_player: ^2.6.1
  chewie: ^1.5.0
  flutter_facebook_auth: ^5.0.11

dev_dependencies:
  flutter_lints: ^2.0.1
  path_provider: ^2.0.14

dependency_overrides:
  intl: ^0.18.0

flutter:
  uses-material-design: true

  assets:
    - .env
    - assets/i18n/en.json
    - assets/i18n/nl.json
  fonts:
    - family: OpenSans
      fonts:
        - asset: assets/fonts/OpenSans-Regular.ttf
    - family: OpenSansExtraBold
      fonts:
        - asset: assets/fonts/OpenSans-ExtraBold.ttf

Describe the Bug

I am following the instructions for web, but I receive the error when I add the code to main.dart on Flutter 3.10.3

image

image

Expected Behavior

No errors

To Reproduce

Follow: https://facebook.meedu.app/docs/5.x.x/web

Relevant log output

Launching lib/main.dart on Web Server in debug mode...
lib/main.dart:35:26: Error: The method 'webInitialize' isn't defined for the class 'FacebookAuth'.
 - 'FacebookAuth' is from 'package:flutter_facebook_auth/flutter_facebook_auth.dart'
 ('../../../.pub-cache/hosted/pub.dev/flutter_facebook_auth-5.0.11/lib/flutter_facebook_auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'webInitialize'.
    await FacebookAuth.i.webInitialize(
                         ^^^^^^^^^^^^^

flutter doctor -v

[✓] Flutter (Channel stable, 3.10.3, on Linux Mint 21.1 5.15.0-73-generic,
    locale en_US.UTF-8)
    • Flutter version 3.10.3 on channel stable at /home/joost/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f92f44110e (2 days ago), 2023-06-01 18:17:33 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
      for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at
    /snap/chromium/current/usr/lib/chromium-browser/chrome)
    ! /snap/chromium/current/usr/lib/chromium-browser/chrome is not executable.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang),
      or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake),
      or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install
      ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.29.2
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install
      libgtk-3-dev)

[✓] Android Studio (version 2022.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.78.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.66.0

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Linux Mint 21.1 5.15.0-73-generic

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.

Info.plist (iOS)

No response

Podfile (iOS)

No response

AndroidManifest.xml

No response

MainActivity.java

No response

MainActivity.kt

No response

index.html

<!DOCTYPE html>
<html>

<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
  -->
  <base href="$FLUTTER_BASE_HREF">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="app">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png" />

  <title>app</title>
  <link rel="manifest" href="manifest.json">

  <script>
    // The value below is injected by flutter build, do not touch.
    var serviceWorkerVersion = null;
  </script>
  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>
</head>

<body>
  <script>
    window.addEventListener('load', function (ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        }
      }).then(function (engineInitializer) {
        return engineInitializer.initializeEngine();
      }).then(function (appRunner) {
        return appRunner.runApp();
      });
    });
  </script>
</body>

</html>

Info.plist (macOS)

No response

darwin-morocho commented 10 months ago

please follow https://facebook.meedu.app/docs/5.x.x/macos

jstdk commented 10 months ago

Thanks @darwin-morocho. That does not work unfortunately, the flutter page won't load.

image

jstdk commented 10 months ago

Sorry, that turned out to be uBlock Origin blocking stuff