- Document about library, installation, coding and testing and some problems about i need everyone helps… 🐼
uni_links: ^0.5.1
-
**You need to declare at least one of the two intent filters in android/app/src/main/AndroidManifest.xml:
-
replace “[YOUR_SCHEME]” by http or https
-
replace “[YOUR_HOST]” by waodate.com
import 'package:uni_links/uni_links.dart';
Write function handler
Future<void> initUniLinks() async {
_sub = uriLinkStream.listen((Uri uri) {
List<String> paths = uri.path.split("https://github.com/");
if (paths.contains('home')) {
navGlogbalKey.currentState.pushNamedAndRemoveUntil(
AppRoutes.HOME,
(route) => false,
arguments: {
'index': 0,
},
);
} else if (paths.contains('profile')) {
navGlogbalKey.currentState.pushNamed(
AppRoutes.PROFILE,
arguments: {'userId': paths.last},
);
} else if (paths.contains('vvip')) {
navGlogbalKey.currentState.pushNamedAndRemoveUntil(
AppRoutes.HOME,
(route) => false,
arguments: {
'index': 0,
},
);
navGlogbalKey.currentState.pushNamed(
AppRoutes.VVIP,
);
} else if (paths.contains('concept')) {
navGlogbalKey.currentState.pushNamedAndRemoveUntil(
AppRoutes.HOME,
(route) => false,
arguments: {
'index': 1,
},
);
navGlogbalKey.currentState.pushNamed(
AppRoutes.DETAILS_CONCEPT,
arguments: {
'conceptId': paths.last,
'appointmentModel': AppointmentModel(
appointmentId: paths.last,
),
},
);
}
// Use the uri and warn the user, if it is not correct
}, onError: (err) {
// Handle exception by warning the user their action did not succeed
});
}
Call function run when open app and keep alive until user killed application:
@override
void initState() {
initUniLinks();
}
Case | Android | iOS |
---|---|---|
https://waodate.com/home | DONE |
DONE |
https://waodate.com/vvip | DONE |
DONE |
https://waodate.com/profile/:id | DONE |
DONE |
https://waodate.com/concept/:id | DONE |
DONE |
If you want test, lets run below bash code in terminal
Android
adb shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://waodate.com/home"'
iOS
/usr/bin/xcrun simctl openurl booted "https:waodate.com/home"
- I were config for iOS like documents: uni_link
- But can’t test on iOS simulator. I think have a problem here: Apple_Document
- OKAY, if you have a idea for resolve this problem, lets contact me by email or skype
Leave a Reply