-
-
Save safademirel07/c2ab6ecf4361b15920aff9ff16eea817 to your computer and use it in GitHub Desktop.
tutorial4
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 initDynamicLinks() async { | |
FirebaseDynamicLinks.instance.onLink( | |
onSuccess: (PendingDynamicLinkData dynamicLink) async { | |
final Uri deepLink = dynamicLink?.link; | |
if (deepLink != null) { | |
var deepLinkPath = deepLink.path; | |
var deepLinkQueryParameters = deepLink.queryParameters; | |
parseColorAndNavigate(deepLinkQueryParameters); | |
} | |
}, onError: (OnLinkErrorException e) async { | |
print('onLinkError'); | |
print(e.message); | |
}); | |
} | |
void parseColorAndNavigate(Map<String, String> deepLinkQueryParameters) { | |
if (deepLinkQueryParameters.containsKey("color")) { | |
String colorStringValue = deepLinkQueryParameters["color"].toString(); | |
try { | |
int colorIntegerValue = int.tryParse(colorStringValue); | |
Color color = Color(colorIntegerValue); | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => DynamicPage(backgroundColor: color), | |
), | |
); | |
} catch (e) { | |
print("Integer parsing hata."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment