Flutter notes¶
Dart¶
Herald's concepts are the same on both platforms. Where Dart differs from Kotlin, the API follows Dart:
- Futures, not coroutines. Every capability returns a
Future<void>. There is no dispatcher: vendor plugins already do their work off the UI thread. - Await when order matters. A call starts at once and doesn't wait for earlier ones, so two calls you don't await can reach a vendor in either order. When order matters, such as turning collection off before tracking, await the first call.
- Four value types. Dart has one integer and one floating-point type, so
AnalyticsValueis.string,.int,.doubleor.bool. Write parameters as a map with dot shorthands:{'seats': .int(3)}. - Failures come as one object. The error reporter receives an
AnalyticsFailure, with the vendor, the call, the error and its stack trace, like Flutter'sFlutterError.onError. - Constructors, not builders.
Herald(providers: [...])andHeraldProvider(name: ..., events: ...). Chains take a list:CompositeFirebaseEventTrackerFactory([...]). - Vendor-qualified handler names. Dart has no sub-packages, so trackers are named after their
vendor, as factories already are:
GenericFirebaseEventTracker,TokenAdjustEventTracker. - Adjust takes no SDK object. The Adjust plugin is static functions, so the adapter calls them directly. Its tests record what the plugin sends over its channel.
Failures¶
An AnalyticsFailure carries the stack trace of the error, as well as the vendor's name, the
operation and the error, so you can pass both to a crash reporter.