@@ -41,7 +41,7 @@ Add this to your package's pubspec.yaml file:
4141
4242``` yaml
4343dependencies :
44- uni_links_desktop : ^0.1.2
44+ uni_links_desktop : ^0.1.3
4545` ` `
4646
4747Or
@@ -59,16 +59,18 @@ dependencies:
5959` ` ` dart
6060import 'package:uni_links_desktop/uni_links_desktop.dart';
6161
62- void main() {
63- if (Platform.isMacOS || Platform.isWindows) {
64- enableUniLinksDesktop();
65- if (Platform.isWindows) {
66- registerProtocol('unilinks');
67- }
62+ Future<void> main() async {
63+ WidgetsFlutterBinding.ensureInitialized();
64+
65+ if (Platform.isWindows) {
66+ registerProtocol('unilinks');
6867 }
6968
70- runApp(MyApp());
69+ runApp(const MaterialApp(
70+ home : MyApp(),
71+ ));
7172}
73+
7274```
7375
7476> Just add these extra steps, see [ uni_links] ( https://github.com/avioli/uni_links/tree/master/uni_links ) for other usage
@@ -138,13 +140,13 @@ Change the file `windows/runner/main.cpp` as follows:
138140# include "flutter_window.h"
139141# include "utils.h"
140142
141- + #include <protocol_handler/protocol_handler_plugin .h>
143+ + #include <uni_links_desktop/uni_links_desktop_plugin .h>
142144
143145int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
144146 _In_ wchar_t *command_line, _In_ int show_command) {
145147+ HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"uni_links_desktop_example");
146148+ if (hwnd != NULL) {
147- + DispatchToProtocolHandler (hwnd);
149+ + DispatchToUniLinksDesktop (hwnd);
148150+
149151+ ::ShowWindow(hwnd, SW_NORMAL);
150152+ ::SetForegroundWindow(hwnd);
0 commit comments