creating a custom Flutter action using Amplitude's pub.dev package

  • 16 May 2022
  • 1 reply
  • 111 views

Userlevel 2
Badge

Hello,

I posted the following question also in Stackoverflow: https://stackoverflow.com/questions/72254438/how-do-i-use-amplitudes-flutter-package-in-a-custom-action

 

I installed the following pub-dev package: https://pub.dev/packages/amplitude_flutter

Amplitude has a flutter SDK and a flutter package which should allow the app to send events to the Amplitude server.

I want to execute it within a custom action so that I can send events when the users performs certain actions.

Here is the code[1].  IDE errors include:

    Error: 'Amplitude' is imported from both 'package:amplitude_flutter/amplitude.dart' and 'package:amplitude_flutter/web/amplitude_js.dart

    Error: Can't assign to the final variable 'analytics'.
    analytics = Amplitude.getInstance(instanceName: "Assembly");

I have also tried to run “flutter run” in an IOS Simulator on a Mac.  I am unable to get it to run.

When I comment out everything in the custom action, it does run.


  [1]: https://gist.github.com/timfong888/c36ae11afe053f331143dd4db033c6a4

 


1 reply

Userlevel 6
Badge +9

Hi @assembly Thanks for posting here! 😁 I noticed that you found some answers in this thread and wanted to close the loop here. Please keep us posted if you need any additional support. We’re here to help! 

 

Reply