@@ -11,7 +11,10 @@ import (
11
11
"github.com/go-flutter-desktop/go-flutter/plugin"
12
12
)
13
13
14
- const channelName = "plugins.flutter.io/path_provider"
14
+ var channelNames = []string {
15
+ "plugins.flutter.io/path_provider" ,
16
+ "plugins.flutter.io/path_provider_macos" ,
17
+ }
15
18
16
19
// PathProviderPlugin implements flutter.Plugin and handles method calls to
17
20
// the plugins.flutter.io/path_provider channel.
@@ -38,15 +41,18 @@ func (p *PathProviderPlugin) InitPlugin(messenger plugin.BinaryMessenger) error
38
41
return errors .New ("PathProviderPlugin.ApplicationName must be set" )
39
42
}
40
43
41
- channel := plugin .NewMethodChannel (messenger , channelName , plugin.StandardMethodCodec {})
42
- channel .HandleFunc ("getTemporaryDirectory" , p .handleTempDir )
43
- channel .HandleFunc ("getApplicationSupportDirectory" , p .handleAppSupportDir )
44
- channel .HandleFunc ("getLibraryDirectory" , p .handleLibraryDir ) // MacOS only
45
- channel .HandleFunc ("getApplicationDocumentsDirectory" , p .handleAppDocumentsDir )
46
- channel .HandleFunc ("getStorageDirectory" , p .returnError ) // Android only
47
- channel .HandleFunc ("getExternalCacheDirectories" , p .returnError ) // Android only
48
- channel .HandleFunc ("getExternalStorageDirectories" , p .returnError ) // Android only
49
- channel .HandleFunc ("getDownloadsDirectory" , p .handleDownloadsDir )
44
+ for _ , channelName := range channelNames {
45
+ channel := plugin .NewMethodChannel (messenger , channelName , plugin.StandardMethodCodec {})
46
+ channel .HandleFunc ("getTemporaryDirectory" , p .handleTempDir )
47
+ channel .HandleFunc ("getApplicationSupportDirectory" , p .handleAppSupportDir )
48
+ channel .HandleFunc ("getLibraryDirectory" , p .handleLibraryDir ) // MacOS only
49
+ channel .HandleFunc ("getApplicationDocumentsDirectory" , p .handleAppDocumentsDir )
50
+ channel .HandleFunc ("getStorageDirectory" , p .returnError ) // Android only
51
+ channel .HandleFunc ("getExternalCacheDirectories" , p .returnError ) // Android only
52
+ channel .HandleFunc ("getExternalStorageDirectories" , p .returnError ) // Android only
53
+ channel .HandleFunc ("getDownloadsDirectory" , p .handleDownloadsDir )
54
+ }
55
+
50
56
return nil
51
57
}
52
58
0 commit comments