鍘嗘椂2涓鏈堬紝鍩轰簬寮€婧愮綉鏄撲簯API鐨勪竴娆句娇鐢?code>Flutter寮€鍙戠殑妗岄潰闊充箰绋嬪簭缁堜簬瀹屾垚浜嗗畠鐨勭涓€涓増鏈瑅1.0.0馃帀銆傚啀娆℃劅璋㈠ぇ浣负鎴戜滑鏁寸悊骞舵彁渚涗紬澶氭帴鍙c€?/p>
鏁堟灉鍥炬潵涓€娉€?/p>
鏈枃鎺ュ姏涓婁竴绡囦粙缁嶆枃锛屼富瑕佷负澶у璁茶В涓嬪紑鍙?strong>DreamMusic涓亣鍒扮殑鍚勭闂锛屼互鍙婂叧閿疄鐜般€?/p>
鐢ㄦ埛鐧诲綍
鐢ㄦ埛鐧诲綍鍙互璇存槸椤圭洰寮€鍙戠殑绗竴姝ワ紝浣犲彧鏈夋嬁鍒癱ookie浜嗭紝寰堝鎺ュ彛鎵嶈兘姝e父杩斿洖鏁版嵁銆傛垜鎯筹紝姣忎竴涓熀浜庣綉鏄撲簯API寮€鍙戦」鐩殑閮芥湁杩囦笅闈㈢殑缁忓巻锛岃皟鐢ㄧ櫥褰曟帴鍙?/login/cellphone
锛圥S锛氬瘑鐮佺櫥褰曞拰楠岃瘉鐮佺櫥褰曪級杩斿洖{code: -460, message: 鈥樼綉缁滃お鎷ユ尋锛岃绋嶅€欏啀璇曪紒鈥檥
銆侴Ithub涓婃湁浜哄洖绛斾紶鍏?code>realIP鍙В銆傚叾瀹炵湡瀹炲師鍥犲氨鏄綘娌′紶cookie锛屾垨鑰呬紶鐨刢ookie涓嶅銆?strong>鍙鍦ㄨ姹傚ご涓婃坊鍔燾ookie鍗冲彲銆?/p>
DreamMusic鐨勭櫥褰曟€佹湁涓夌锛屽垎鍒槸锛氭湭鐧诲綍锛屾父瀹㈢櫥褰曪紝鐢ㄦ埛鐧诲綍銆?/p>
澶ц嚧娴佺▼鏄疉PP鍚姩锛岃鍙栨湰鍦颁繚瀛樼殑cookie锛屽鏋滄病鏈夎幏鍙栧埌锛岄偅涔堟槸绗竴娆″惎鍔ㄦ垨鏄凡缁忛€€鍑虹櫥褰曚簡锛岃皟鐢ㄦ父瀹㈢櫥褰曟帴鍙c€傚鏋滃瓨鍦╟ookie锛屼絾鏄病鏈?code>MUSIC_U杩欎釜cookie锛岄偅涔堝氨璁や负褰撳墠鏄父瀹㈢櫥褰曠姸鎬併€傚鏋滄槸瀛樺湪cookie锛屽苟涓攃ookie涓湁MUSIC_U
杩欎釜cookie鐨勮瘽锛岃鏄庡綋鍓嶆槸鐢ㄦ埛鐧诲綍鐘舵€侊紝鎷夊彇鐢ㄦ埛淇℃伅鎺ュ彛鑳借幏鍙栧埌鍏蜂綋鐨勭敤鎴蜂俊鎭紝濡傛樀绉帮紝绛惧悕锛屾墜鏈哄彿绛夈€?/p>
[鍥剧墖涓婁紶澶辫触...(image-2f26d3-1667455027467)]
鎵€浠ヨ瀹炵幇涓婇潰鐨勯€昏緫锛屽叧閿湪浜巆ookie濡備綍鑾峰彇锛屼粠鍝噷鑾峰彇銆備袱涓湴鏂癸紝涓€涓槸鍦ㄦ瘡涓帴鍙e搷搴斿ご鐨?code>set-cookie瀛楁涓幏鍙栵紝杩樻湁涓€涓湴鏂规槸鍦ㄧ櫥褰曟帴鍙g殑鍝嶅簲浣撲腑鑾峰彇锛屾瘮濡傛墜鏈哄彿鐧诲綍杩斿洖鐨刯son涓湁涓猚ookie瀛楁璁板綍浜哻ookie鐨勫€笺€?/p>
[鍥剧墖涓婁紶澶辫触...(image-97b6af-1667455027467)]
杩欓噷鎺ㄨ崘涓€涓狥lutter涓ソ鐢ㄧ殑cookie瑙f瀽鍜岀鐞嗕笁鏂瑰簱锛?code>cookie_jar鍜?code>dio_cookie_manager锛屽墠鑰呬富瑕佹槸cookie鐨勮В鏋愬拰io鎿嶄綔锛屽悗闈㈢殑鏄?code>dio鐨勬嫤鎴櫒锛屽彲浠ュ湪HTTP璇锋眰涓敞鍏ュ拰璇诲彇cookie锛岄潪甯告柟渚裤€?/p>
涓嶈繃杩欓噷鏈変釜鍧戯紝灏辨槸濡傛灉浣犱娇鐢ㄧ殑鏄櫥褰曞悗鍝嶅簲浣撲腑鐨刢ookie锛屼篃灏辨槸杩斿洖json涓殑cookie鐨勫€硷紝閭d箞浼氬瓨鍦ㄨВ鏋愬紓甯哥殑鎯呭喌锛屼篃灏辨槸cookiejar浼氳В鏋愬け璐ワ紝骞朵涪澶遍儴鍒哻ookie锛屽叿浣撳師鍥犲彲浠ヨ嚜琛屾煡鐪嬩袱鑰呯殑鍖哄埆銆傚洜姝ゆ垜鍦ㄩ」鐩腑鍐欎簡涓緟鍔╁伐鍏风被CookieParse
锛屽厛淇鏍煎紡闂锛屽啀浜ょ粰cookieJar
澶勭悊銆?/p>
鍋氬埌涓婇潰杩欎簺锛屼笉鍑烘剰澶栵紝鐧诲綍搴旇鏄病闂浜嗙殑銆?/p>
闊充箰鎾斁鍔熻兘瀹炵幇
闊充箰鎾斁鍔熻兘鍙互璇存槸杩欎釜椤圭洰鐨勬牳蹇冧簡锛屽綋鐒剁敱浜嶧lutter鏄釜UI妗嗘灦锛屽洜姝よ繖閮ㄥ垎鍔熻兘杩樻槸闇€瑕佷緷璧栧師鐢熷疄鐜般€傚競闈笂鍋氱殑濂界殑鏈夊叧闊充箰鎾斁鐨勫簱鍏跺疄涔熷氨涓や釜锛?code>just_audio鍜?code>audioplayers銆?/p>
[鍥剧墖涓婁紶澶辫触...(image-ec09e6-1667455027467)]
鑰岃鍚屾椂鏀寔macos
锛?code>windows锛?code>linux鐨勫氨鍙湁audioplayers
浜嗐€傛墍浠ユ病寰楅€夛紝灏辩敤audioplayers
浜嗐€?/p>
褰撶劧鍦ㄦ闈㈢寮曞叆audioplayers
锛屼笉鍑烘剰澶栫殑鎶ラ敊浜嗐€?/p>
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
Exception: CocoaPods not installed or not in valid state.
杩欎釜闂鐪嬩笂鍘诲儚鏄洜涓篊ocoapods娌℃湁瀹夎锛屽鑷存棤娉曠粰macos锛坕OS锛夊钩鍙板畨瑁呮纭殑渚濊禆鐜锛屽洜姝ゆ棤娉曞惎鍔ㄣ€備簨瀹炰笂锛宑ocoapods鏄畨瑁呬簡鐨勶紝鍙鍘绘帀audioplayers
杩欎釜涓夋柟搴擄紝绔嬮┈鑳芥甯歌窇璧锋潵銆傞偅涔堥棶棰樺氨鍑哄湪杩欎釜涓夋柟搴撲笂锛屽畠鐨勫紩鍏ヤ技涔庡鑷翠簡Flutter璇嗗埆寮傚父銆?/p>
鐜板湪audioplayer鐨刧it浠撳簱鐨刬ssue涓婃悳绱簡涓€鐣紝娌℃壘鍒扮浉鍏抽棶棰樸€傜湅鏉ヨ繖涓棶棰樻瘮杈冪壒娈婏紝鍙湁鑷繁閬囧埌杩囥€?/p>
鎴戠殑瑙e喅鍔炴硶锛宮ac绯荤粺鍗囩骇锛寈code鍗囩骇銆傚簲璇ユ湁鍏朵粬瑙e喅鏂规硶锛屾垜杩欒竟鏄濂介亣涓婅鍗囩骇绯荤粺锛岀储鎬у厛鍗囩骇绯荤粺浜嗐€?/p>
杩愯璧锋潵鍚庯紝鍙︿竴涓棶棰樺嚭鐜颁簡銆?/p>
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: AVPlayerItem.Status.failed
#0 MethodChannelAudioplayersPlatform._doHandlePlatformCall
package:audioplayers_platform_interface/method_channel_audioplayers_platform.dart:174
#1 MethodChannelAudioplayersPlatform.platformCallHandler
package:audioplayers_platform_interface/method_channel_audioplayers_platform.dart:147
#2 MethodChannel._handleAsMethodCall
package:flutter/鈥?services/platform_channel.dart:404
#3 MethodChannel.setMethodCallHandler.<anonymous closure>
package:flutter/鈥?services/platform_channel.dart:397
#4 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
package:flutter/鈥?services/binding.dart:380
#5 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
package:flutter/鈥?services/binding.dart:377
#6 _invoke2.<anonymous closure> (dart:ui/hooks.dart:190:15)
#7 _rootRun (dart:async/zone.dart:1426:13)
#8 _CustomZone.run (dart:async/zone.dart:1328:19)
#9 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#10 _invoke2 (dart:ui/hooks.dart:189:10)
#11 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
#12 _Channel.push (dart:ui/channel_buffers.dart:132:31)
#13 ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
#14 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:589:22)
#15 _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)
ERROR鍑虹幇鐨勭洿鎺ュ師鍥犲氨鏄?code>AVPlayerItem鍒濆鍖栧け璐ワ紝澶氫负璺緞/url濉敊锛屽鏋滄槸鎾斁缃戠粶闊充箰锛屼篃鍙兘鏄病鏈夌綉缁滄潈闄愬鑷淬€?/p>
MacOS寮€鍙戝拰iOS寮€鍙戜竴鏍凤紝濡傛灉瑕佺敤涓€浜涚郴缁熺骇鐨勫姛鑳斤紝闇€瑕佺敵璇锋潈闄愶紝鍦?code>info.plist涓坊鍔犻厤缃俊鎭€?/p>
濡傛灉瑕佹敮鎸丠TTPS锛屽湪macos
鐩綍涓嬬殑info.plist
涓坊鍔犲涓嬮敭鍊煎銆?/p>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
濡傛灉鏄?code>iOS鍒拌繖涓€姝ュ氨缁撴潫浜嗭紝MacOS
寮€鍙戝垯瑕佸鍋氫竴姝ワ紝鍚?code>macos鐩綍鐨?code>DebugProfile.entitlements娣诲姞濡備笅閿€煎銆?/p>
<key>com.apple.security.network.client</key>
<true/>
杩欐椂锛岄煶涔愯兘姝e父鎾斁浜嗐€?/p>
闊充箰鎾斁鐨勬墍鏈夊姛鑳介兘灏佽鍦?code>SongPlayer绫讳笅锛岀洰鍓嶅疄鐜扮殑鍔熻兘鏈夛細鎾斁鍒楄〃锛屾挱鏀撅紝鏆傚仠锛屼笂涓€棣栵紝涓嬩竴棣栵紝闊抽噺璋冭妭锛屾挱鏀捐烦杞埌鎸囧畾鏃堕棿鐐广€?/p>
璺敱鎺у埗鍣?/h2>
鐢ㄨ繃缃戞槗浜戦煶涔愭闈㈢鐨勯兘鐭ラ亾鍦ㄥ簲鐢ㄧ殑宸︿笂瑙掓湁涓袱涓寜閽紝鐢ㄤ簬鎺у埗椤甸潰鍓嶈繘鍜屽悗閫€锛屼互鍙奣ab鐨勫垏鎹紝闈炲父鏂逛究銆傚洜姝よ繖涓疄鐢ㄧ殑鍔熻兘蹇呴』鍔犱笂銆?/p>
瑕佸疄鐜拌繖涓姛鑳斤紝鎴戜滑蹇呴』璁板綍鐢ㄦ埛鐨勬瘡涓€娆¢〉闈㈠垏鎹㈠拰tab鍒囨崲銆傛垜灏嗚繖涓涓烘娊璞′负RouteAction
锛岄〉闈㈣烦杞槸PageRouteAction
锛孴ab鍒囨崲鏄?code>TabRouteAction銆傝繖浜沘ction閮界粺涓€鐢?code>RouteControlManager绠$悊锛岃繖鏍峰氨鑳藉湪鍓嶈繘鍜屽悗閫€鏃跺埄鐢ㄨ繖浜沘ction鏉ユ帶鍒堕〉闈㈢殑鍒囨崲浜嗐€?/p>
Tab鍒囨崲涔熷氨鏄晶杈规爮鐨勬椂鏈哄ソ澶勭悊锛屾瘯绔熻繖涓晶杈规爮鏄嚜瀹氫箟鐨勶紝鎸夐挳鐨勭偣鍑诲畬鍏ㄥ彲鎺с€傛垜浠洿鎺ユ潵鐪嬮〉闈㈢殑鍒囨崲涔熷氨鏄鑸殑push鍜宲op鎿嶄綔銆傝繖涓€庝箞鐩戝惉锛熺瓟妗堟槸浣跨敤鑷畾涔?code>NavigatorObserver銆侼avigatorObserver涓毚闇蹭簡瀵艰埅鐨勬瘡涓€娆ush鍜宲op鎿嶄綔锛屼互鍙婄浉搴旂殑璺敱route瀵硅薄锛屼粠涓垜浠彲浠ヨ幏鍙栭亾瀵瑰簲鐨?code>navigatorstate鍜?code>routesetting锛屽洜姝ゅ浜庨〉闈㈢殑鍒囨崲涔熻鎴戜滑鎺屾帶鍦ㄤ簡鎵嬩腑銆?/p>
class CustomNavigatorObserver extends NavigatorObserver {
// push: route鏄皢瑕乸ush鐨勮矾鐢?
@override
void didPush(Route route, RoutepreviousRoute) {
super.didPush(route, previousRoute);
RouteControlManager().pushAction(PageRouteAction(navigator: route.navigator, settings: route.settings));
}
// pop: route鏄皢瑕佽pop鐨勮矾鐢?
@override
void didPop(Route route, RoutepreviousRoute) {
super.didPop(route, previousRoute);
RouteControlManager().popAction(PageRouteAction(navigator: route.navigator, settings: route.settings));
}
}
杩欓噷瀵硅繖鍧楁病鏈夋繁鍏ョ殑鍚屽灏辫闂簡锛屼负鍟ユ嬁鍒?code>avigatorState鍜?code>routesetting灏卞彲浠ユ帶鍒堕〉闈㈢殑鍒囨崲浜嗐€傞偅鎴戝氨澶氬槾涓€鍙ャ€?/p>
鎴戜滑鍏堟潵鐪嬩笅Flutter涓〉闈㈣烦杞槸濡備綍鎺у埗鐨勩€傛湁涓や釜椤甸潰A锛孊銆備粠椤甸潰A鍒伴〉闈鍙玴ush锛屽啀浠庨〉闈鍥炲埌椤甸潰A鍙玴op銆?/p>
// push
Navigator.pushNamed(context, "B");
// pop锛岃繑鍥炲鑸爤鐨勪笂涓€灞?
Navigator.pop(context);
杩欓噷鐨勫叧閿氨鏄幏鍙栧埌涓婁笅鏂?code>context锛屽簳灞傞€氳繃context
鏌ユ壘鍒版爲缁撴瀯涓渶杩戠殑NavigatorState
锛屼粠鑰屾帶鍒堕〉闈㈢殑瀵艰埅銆備篃灏辨槸context 鈫?NavigatorState
銆備负浠€涔堣杩欐牱锛屽洜涓烘垜浠殑姣忎釜椤甸潰鍦ㄥ鑸腑閮芥槸浠?code>OverlayEntry鐨勫舰寮忓瓨鍦ㄥ苟琚鐞嗙殑锛屾嬁鍒颁簡NavigatorState
涔熷氨浠h〃鎷垮埌浜嗛〉闈㈢殑鎺у埗鏉冦€?/p>
鍥炲埌鑷畾涔夌殑NavigatorObserver
涓紝杩欐椂锛屾垜浠啀杩涜Navigator.pushNamed(context, 鈥渟etting鈥?;
鏃讹紝灏卞彲浠ュ湪CustomNavigatorObserver
涓嫤鎴埌璺宠浆淇℃伅浜嗐€?/p>
flutter: [route]push --> ModelRoute(RouteSettings("setting", null),
animation: AnimationController#68be1(鈻?0.000; for ModelRoute)),
MaterialPageRoute<dynamic>(RouteSettings("/", null),
animation: AnimationController#c6365(鈴?1.000; paused;
for MaterialPageRoute<dynamic>(/)))
鑰?code>CustomNavigatorObserver鎴栬€呭洖璋冨嚱鏁颁腑鐨勫弬鏁?code>Route閮借兘鐩存帴鑾峰彇鍒?code>NavigatorState锛屽埌杩欓噷锛屾垜浠笉閫氳繃context
鑰岀洿鎺ヨ幏鍙栧埌浜嗘帶鍒跺鑸殑NavigatorState
銆?/p>
鐜板湪锛屾垜浠氨鍙互鍐欎袱涓柟娉曟潵鎺у埗鍓嶈繘鍜岃繑鍥炪€?/p>
杩斿洖锛岃皟鐢?code>navigator鐨?code>pop()銆?/p>
void back() {
if (canBack()) {
final current = _actions[_currentIndex];
_currentIndex -= 1;
if (current.type == RouteActionType.page) {
PageRouteAction action = current as PageRouteAction;
action.navigator?.pop();
}
notifyListeners();
}
}
鍓嶈繘锛岃皟鐢?code>navigator鐨?code>pushNamed鏂规硶銆?/p>
void forward() {
if (canForward()) {
_currentIndex += 1;
final current = _actions[_currentIndex];
if (current.type == RouteActionType.page)
PageRouteAction action = current as PageRouteAction;
if (action.settings.name != null) {
action.navigator?.pushNamed(action.settings.name!,
arguments: action.settings.arguments);
}
}
notifyListeners();
}
}
杩欐牱锛屾垜浠氨鍙互鎼厤杩斿洖鍜屽墠杩涙寜閽紝閫氳繃璋冪敤back()
鍜?code>forward()鏉ュ叏灞€鎺у埗椤甸潰鐨勫墠杩涘拰鍚庨€€浜嗭紝瀹岀編銆?/p>
姝岃瘝婊氬姩鍜屽畾浣?/h2>
鐭ラ亾姣忎竴琛岀殑楂樺害锛屼互鍙婃瓕璇嶅垪琛ㄧ殑楂樺害锛屽彲浠ラ€氳繃context鐨刦indRenderObject鏉ヨ幏鍙栨覆鏌撶粍浠剁殑灏哄銆?/p>
final ob = context.findRenderObject();
if (ob != null && ob is RenderBox) {
model?.size = ob.size;
}
缁撳悎婊氬姩鐩戝惉NotificationListener<ScrollNotification>
锛岃幏鐭ュ綋鍓嶇殑婊氬姩鍋忕Щ銆傝绠楀嚭闇€瑕佸亸绉荤殑璺濈锛岃皟鐢?code>ScrollController鐨?code>animateTo鍗冲彲瀹炵幇婊氬姩鍒版寚瀹氳鐨勬瓕璇嶅姛鑳姐€?/p>
scrollController.animateTo(offsety,
duration: const Duration(milliseconds: 200), curve: Curves.ease);
涓嬭浇闊充箰
DreamMusic杩樺疄鐜颁簡闊充箰涓嬭浇鍔熻兘銆備笉杩囬亣鍒颁簡鏂囦欢鏉冮檺闂锛屾垜鍦ㄤ笅杞芥瓕鏇插皾璇曞啓鍏ユ湰鍦癉ownload鐩綍鏃讹紝鎶ヤ互涓嬮敊璇細
鍑虹幇寮傚父銆?
FileSystemException (FileSystemException: Cannot create file, path = '/Users/zl/Library/Containers/com.jinfeng.dreammusic.dreamMusic/Data/Downloads' (OS Error: Operation not permitted, errno = 1))
杩欐槸鍥犱负鎴戜滑娌℃湁璇诲啓鏂囦欢鐨勬潈闄愶紝闇€瑕佸幓淇敼涓嬬敤鎴风殑鏉冮檺銆?/p>
閫氳繃Apple鐨勫紑鍙戞枃妗f壘鍒版湁鍏虫潈闄愰棶棰樼殑璇存槑銆傚叾涓湁涓巿鏉冪閽ョ殑key涓?code>com.apple.security.files.downloads.read-write 锛岃〃绀?strong>瀵圭敤鎴风殑涓嬭浇鏂囦欢澶圭殑璇?鍐欒闂潈闄?/strong>銆傞偅涔堬紝浣跨敤Xcode鎵撳紑Flutter椤圭洰涓殑mac搴旂敤锛屼慨鏀瑰伐绋嬬洰褰曚笅鐨?code>DebugProfile.entitlements鏂囦欢锛屽悜entitlements
鏂囦欢涓坊鍔?code>com.apple.security.files.downloads.read-write锛屽苟灏嗗€艰缃负YES锛屼繚瀛樺悗閲嶅惎Flutter椤圭洰銆傚彂鐜板凡缁忓彲浠ュ悜涓嬭浇鐩綍涓鍐欐枃浠朵簡銆?/p>
褰撶劧锛岃繖鏄甯告搷浣溿€傝繕鏈変釜楠氭搷浣滃氨鏄叧闂郴缁熺殑娌欑洅鏈哄埗銆傚皢entitlements
鏂囦欢鐨?code>App Sandbox璁剧疆涓篘O銆傝繖鏍锋垜浠氨鍙互璁块棶浠绘剰璺緞浜嗐€傚綋鐒跺叧闂簲鐢ㄧ殑娌欑洅涔熷氨鐩稿綋浜庡叧闂簡搴旂敤鐨勯槻鎶ゆ満鍒讹紝鍥犳杩欎釜閫夐」鎱庣敤銆?/p>
涓嬭浇姝屾洸鍚庯紝姝屾洸鐨勫悕瀛楃瓑淇℃伅濡備綍淇濆瓨锛?/h2>
杩欓噷鏈変袱涓柟妗堬紝涓€涓槸鍚屾椂淇濆瓨涓€涓猨son鏂囦欢锛岀敤浜庤褰曟瓕鏇蹭俊鎭紝杩欎釜鏂规鐨勭己鐐规槸鏁版嵁鍒嗘暎锛屽唴瀹瑰鏄撲涪澶便€傚彟涓€涓柟妗堟槸鐩存帴瀛樺叆mp3鏂囦欢鍐呴儴锛岀綉鏄撲簯闊充箰鐨勯煶涔愪笅杞芥槸杩欎箞瀹炵幇浜嗭紝浣跨敤id3搴撳彲浠ヨ鍙栧埌mp3鏂囦欢涓澶栧瓨鍌ㄧ殑淇°€侷D3瑙f瀽鐩稿叧浠嬬粛
鐩墠鐢变簬鎶€鏈師鍥狅紝鏆傛椂閲囩敤浜嗕笅杞絤p3+json鐨勬柟寮忋€傚悗闈㈡湁鏃堕棿浼氬仛浼樺寲銆傝繖绉嶆柟寮忕壒鍒緷璧栦簬涓や釜鏂囦欢鐨勫畬鏁存€э紝姣曠珶mp3+json鐩稿綋浜庝竴棣栧畬鏁寸殑姝屻€傚洜姝reamMusic杩樺涓嬭浇鏂囦欢鍋氫簡鍒犻櫎鐨勭洃鍚紝閫氳繃涓嬭浇鏂瑰紡瀹炵幇銆?/p>
final stream =
directory.watch(events: FileSystemEvent.delete, recursive: true);
stream.listen((event) async {
//澶勭悊鍒犻櫎鍚庣殑閫昏緫
}
Show In Finder瀹炵幇
褰撴椂鐪嬪埌杩欎釜鍔熻兘锛岀涓€鍙嶅簲灏辨槸缃戜笂鎵炬枃浠舵搷浣滅浉鍏崇殑搴撱€傛瘮杈冩湁鍚嶇殑鏈?code>file_selector鍜?code>file_picker銆傝繖涓や釜閮芥彁渚涗簡鏂囦欢閫夋嫨鍔熻兘锛屼絾鏄病鏈夊崟绾殑鎵撳紑鏂囦欢鐩綍鐨勯€夐」銆傜劧鍚庢垜鐪嬩簡file_picker鐨勫疄鐜帮紝濂藉浼欙紝绔熺劧鏄洿鎺ラ€氳繃鍛戒护琛屽疄鐜扮殑锛岃繖褰撴椂灏辫鎴戠伒鎰熶竴闂紝鏈夊姙娉曚簡銆?/p>
open 鍛戒护
鎼炲畾涓€鍒囥€?/p>
class ShowInFinder {
/// 鎵撳紑鐩綍
static void open({StringinitialDirectory}) {
if (initialDirectory?.isNotEmpty == true) {
final type = FileSystemEntity.typeSync(initialDirectory!);
if (type == FileSystemEntityType.file || type == FileSystemEntityType.link) {
debugPrint("[finder]$initialDirectory, 涓嶆槸鐩綍");
return;
}
if (type == FileSystemEntityType.notFound) {
// 鎸囧畾鐩綍涓嶅瓨鍦紝鍒涘缓
Directory(initialDirectory).create();
}
}
String argument = initialDirectory ?'.';
Process.run("open", [argument]);
}
}
淇敼妗岄潰搴旂敤鐨勫浘鏍囧拰鍚嶇О
搴旂敤鍚嶇О鍜屽浘鏍囬兘闇€瑕佸師鐢熷伐绋嬩腑鍘婚厤缃紝杩欓噷涔熷氨鏄痬acos銆亀indows銆乴inux鐩綍銆?/p>
macOS閰嶇疆鐪嬭繖閲屻€?/p>
windows閰嶇疆鐪嬭繖閲屻€?/p>
Linux閰嶇疆鐪嬭繖閲屻€?/p>
杩欓噷鎴戝彧閰嶄簡macos鍜寃indows鐨勶紝姣曠珶璋佷細鍘荤敤linux杩愯杩欎釜椤圭洰鍛紒锛堝搱鍝堬紝鍏跺疄灏辨槸鎳掞級
鏈€鍚?/h2>
鍙傝€冩枃妗?/h2>
Mac娌欑洅鏈哄埗鍜屾潈闄愰厤缃?/p>
MP3鏂囦欢缁撴瀯瑙f瀽(瓒呰缁?
MP3鏍囩鏍煎紡锛圛D3锛孉PE锛夎秴璇︾粏瑙i噴