GithubHelp home page GithubHelp logo

PlatformException(error, TypeError: Cannot read properties of undefined (reading 'getInstance'), null, null) about amplitude-flutter HOT 5 CLOSED

amplitude avatar amplitude commented on June 6, 2024 2
PlatformException(error, TypeError: Cannot read properties of undefined (reading 'getInstance'), null, null)

from amplitude-flutter.

Comments (5)

yuhao900914 avatar yuhao900914 commented on June 6, 2024 4

Did you append the Amplitude-Javascript snippet in to your index.html? @JideGuru
https://developers.amplitude.com/docs/flutter-setup#flutter-web-support

from amplitude-flutter.

nanox77 avatar nanox77 commented on June 6, 2024 2

I have the same problem in Flutter Web 2.5.3

from amplitude-flutter.

JideGuru avatar JideGuru commented on June 6, 2024

My bad. I've added the javascript snippet and now it's working

from amplitude-flutter.

mhkojoana avatar mhkojoana commented on June 6, 2024

how did you add the javascript snippet?? i'm currently experiencing that problem

from amplitude-flutter.

Spixz avatar Spixz commented on June 6, 2024

Hello, I have the same error even with the good import according to the flutter documentation. My app run in the web browser.

import 'package:amplitude_flutter/amplitude.dart';
import 'package:amplitude_flutter/identify.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Amplitude.getInstance().init("my_key");

  runApp(const MyApp());
}

OR

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final Amplitude analytics = Amplitude.getInstance(instanceName: "project");

    analytics.init("my_key");

    analytics.logEvent('MyApp startup', eventProperties: {
      'friend_num': 10,
      'is_heavy_user': true
    });

  runApp(const MyApp());
}

Thanks for your help.

Amplitude_flutter: ^3.13.0
Flutter Version: 3.3.9
Device: Chrome
Device OS and Version: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

from amplitude-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.