Created
July 20, 2022 20:25
-
-
Save timfong888/2a250252f5b66d6b53f17fc4f749004e to your computer and use it in GitHub Desktop.
Listener routing to named Route
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
await Firebase.initializeApp(); | |
FFAppState(); // Initialize FFAppState | |
GetSocial.addOnInitializedListener(() => { | |
// GetSocial SDK is ready to use | |
}); | |
setupLocator(); | |
runApp(MyApp()); | |
locator<LandingPageData>().referralID = "defaultReferralID"; | |
registerListeners(); | |
} | |
void registerListeners() { | |
Invites.setOnReferralDataReceivedListener((received) { | |
globalReferralData = received; | |
print(globalReferralData); | |
print(globalReferralData.linkParams); | |
print("listener - socialdata"); | |
String passedReferralID = | |
globalReferralData.linkParams['referralID'].toString(); | |
String passedCreatorID = | |
globalReferralData.linkParams['creatorID'].toString(); | |
String passedCampaignID = | |
globalReferralData.linkParams['\$campaign_id'].toString(); | |
print(passedReferralID); | |
print(passedCreatorID); | |
print(passedCampaignID); | |
locator<NavigationService>() | |
.navigatorKey | |
.currentState | |
.pushReplacementNamed('landingPage'); // how can I create a named Route? | |
locator<LandingPageData>().referralID = passedReferralID; | |
locator<LandingPageData>().creatorID = passedCreatorID; | |
locator<LandingPageData>().campaignID = passedCampaignID; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment