initialiseEventService function
void
initialiseEventService(})
Function to initialise the package. Should be mandatorily called before accessing package functionalities.
mapKey
is needed to access maps.
apiKey
is needed to calculate ETA.
Steps to get mapKey
/apiKey
available in README.
initLocation
pass this as false if location package is initialised outside, so it is not initialised more than once.
streamAlternative
a function which will return updated lists of EventKeyLocationModel
Implementation
void initialiseEventService(
AtClientImpl atClientInstance, GlobalKey<NavigatorState> navKeyFromMainApp,
{required String mapKey,
required String apiKey,
rootDomain = 'root.atsign.wtf',
rootPort = 64,
dynamic Function(List<EventKeyLocationModel>)? streamAlternative,
bool initLocation = true}) {
/// initialise keys
MixedConstants.setApiKey(apiKey);
MixedConstants.setMapKey(mapKey);
if (initLocation) {
initializeLocationService(
atClientInstance, atClientInstance.currentAtSign!, navKeyFromMainApp,
apiKey: MixedConstants.API_KEY!, mapKey: MixedConstants.MAP_KEY!);
}
/// To have eta in events
AtLocationFlutterPlugin(
[],
calculateETA: true,
);
AtEventNotificationListener().init(atClientInstance,
atClientInstance.currentAtSign!, navKeyFromMainApp, rootDomain);
EventKeyStreamService()
.init(atClientInstance, streamAlternative: streamAlternative);
}