Comments (6)
I've figure it out
from amplitude-flutter.
Would you like to try our SDK without having your own wrapper/inheritance?
To do it, please follow the example. https://github.com/amplitude/Amplitude-Flutter
instance name is:
Name of the SDK instance (e.g. no name for the default instance or a custom name for a named instance).
from amplitude-flutter.
How can I retrieve the instance? Inherited? Instantiating a new one? It only has a function on README.md's example
Should I follow from example folder? Which means that I have to instantiate Amplitude right inside main.dart?
What's the difference between my code and the example? I know, perhaps the InheritedWidget AppState, that's why I'm asking.
from amplitude-flutter.
To retrieve the instance, do
final Amplitude analytics = Amplitude.getInstance(instanceName: "project");
To initialize, do.
// Initialize SDK
analytics.init(widget.apiKey);
You don't need to call the constructor explicitly.
from amplitude-flutter.
So this analytics
variable should be a global instance?
from amplitude-flutter.
class AppAnalytics {
static Amplitude _analytics = Amplitude.getInstance();
static Future<void> start() async {
await _analytics.init(AppConfig.instance.analyticsKey);
}
static void initTrackWithUserId(String userId, {String screenName}) {
_analytics
..setUserId(userId)
..trackingSessionEvents(true)
..logEvent('acessed_$screenName');
}
static void sendEvent(String event, {Map<String, dynamic> props}) {
_analytics.logEvent(event, eventProperties: props);
}
}
This is the new code, no more singletons, still not working, what I'm missing?
Does static functions is a problem? I've added some break points to check if the functions were being called correctly and they were, the key was being passed, the instance is not null... I don't know what else can be done.
from amplitude-flutter.
Related Issues (20)
- Test Issue ticket creation in AMP
- IP and location are transmitted even though CoppaControl is activated HOT 5
- Nested event_properties maps only serialize the top level on web HOT 1
- amplitude_flutter plugin not install my .yaml file HOT 1
- Can you make your account a verified publisher?
- Build failed on iOS with 'dart:js' error HOT 2
- Amplitude is logging wrong User properties for flutter SDK HOT 8
- Unusually Long Sessions HOT 1
- DefaultTrackingOptions configuration is missing on Flutter SDK HOT 4
- Support Kotlin 1.8 HOT 5
- Same '$identify' event being sent on every app background, even after opt-out/not updating user properties
- Version Conflict for 'Amplitude' in amplitude_flutter on CodeMagic Builds
- Execution failed for task ':amplitude_flutter:compileDebugKotlin'. (Android Gradle 8) HOT 3
- Access hidden method error HOT 1
- Session Reply [Web]
- Urgent need of a migration guide/documentation for `amplitude_flutter 4.0.0` HOT 4
- Using with encrypted db
- Only complete initialization after userId is properly set
- Missing NSPrivacyTracking in PrivacyInfo.xcprivacy HOT 4
- How to add VersionCode in amplitude events HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplitude-flutter.