@@ -41,7 +41,7 @@ Add this to your package's pubspec.yaml file:
41
41
42
42
``` yaml
43
43
dependencies :
44
- uni_links_desktop : ^0.1.2
44
+ uni_links_desktop : ^0.1.3
45
45
` ` `
46
46
47
47
Or
@@ -59,16 +59,18 @@ dependencies:
59
59
` ` ` dart
60
60
import 'package:uni_links_desktop/uni_links_desktop.dart';
61
61
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');
68
67
}
69
68
70
- runApp(MyApp());
69
+ runApp(const MaterialApp(
70
+ home : MyApp(),
71
+ ));
71
72
}
73
+
72
74
```
73
75
74
76
> 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:
138
140
# include "flutter_window.h"
139
141
# include "utils.h"
140
142
141
- + #include <protocol_handler/protocol_handler_plugin .h>
143
+ + #include <uni_links_desktop/uni_links_desktop_plugin .h>
142
144
143
145
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
144
146
_In_ wchar_t *command_line, _In_ int show_command) {
145
147
+ HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"uni_links_desktop_example");
146
148
+ if (hwnd != NULL) {
147
- + DispatchToProtocolHandler (hwnd);
149
+ + DispatchToUniLinksDesktop (hwnd);
148
150
+
149
151
+ ::ShowWindow(hwnd, SW_NORMAL);
150
152
+ ::SetForegroundWindow(hwnd);
0 commit comments