{"id":71141,"date":"2026-02-03T09:24:39","date_gmt":"2026-02-03T01:24:39","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/71141.html"},"modified":"2026-02-03T09:24:39","modified_gmt":"2026-02-03T01:24:39","slug":"%e6%88%91%e8%bf%99%e6%a0%b7%e7%94%a8%e9%b8%bf%e8%92%99%e5%8c%96flutter%e4%b8%89%e6%96%b9%e5%ba%93file_selector%e5%ae%9e%e7%8e%b0%e5%8d%95%e5%9b%be%e7%89%87%e5%92%8c%e5%a4%9a%e5%9b%be%e7%89%87%e9%80%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/71141.html","title":{"rendered":"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9"},"content":{"rendered":"<p>\u4f60\u597d&#xff01;&#x1f44b; \u6b22\u8fce\u6765\u5230\u8fd9\u7bc7\u5173\u4e8e file_selector \u5728 HarmonyOS (OpenHarmony) \u4e0a\u4f7f\u7528\u7684\u5b9e\u6218\u6559\u7a0b\u3002<\/p>\n<hr \/>\n<h3>&#xfffd; 1. \u5f15\u5165\u4f9d\u8d56&#xff1a;pubspec.yaml<\/h3>\n<p>\u9996\u5148&#xff0c;\u6211\u4eec\u9700\u8981\u5728\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u5f15\u5165\u9002\u914d\u540e\u7684 file_selector \u5e93\u3002<\/p>\n<p>\u4fee\u6539\u6587\u4ef6&#xff1a;pubspec.yaml<\/p>\n<p>\u64cd\u4f5c&#xff1a;\u5728 dependencies \u8282\u70b9\u4e0b\u6dfb\u52a0 file_selector \u7684 git \u4f9d\u8d56\u914d\u7f6e\u3002<\/p>\n<p><span class=\"token key atrule\">dependencies<\/span><span class=\"token punctuation\">:<\/span><br \/>\n  <span class=\"token key atrule\">flutter<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token key atrule\">sdk<\/span><span class=\"token punctuation\">:<\/span> flutter<\/p>\n<p>  <span class=\"token comment\"># &#x1f447; \u65b0\u589e&#xff1a;\u5f15\u5165 file_selector \u9e3f\u8499\u9002\u914d\u7248\u672c<\/span><br \/>\n  <span class=\"token key atrule\">file_selector<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token key atrule\">git<\/span><span class=\"token punctuation\">:<\/span><br \/>\n      <span class=\"token key atrule\">url<\/span><span class=\"token punctuation\">:<\/span> https<span class=\"token punctuation\">:<\/span>\/\/gitcode.com\/openharmony<span class=\"token punctuation\">&#8211;<\/span>tpc\/flutter_packages.git<br \/>\n      <span class=\"token key atrule\">path<\/span><span class=\"token punctuation\">:<\/span> packages\/file_selector\/file_selector<br \/>\n      <span class=\"token key atrule\">ref<\/span><span class=\"token punctuation\">:<\/span> br_file_selector<span class=\"token punctuation\">&#8211;<\/span>v1.0.3_ohos<\/p>\n<p>&#x1f4a1; \u63d0\u793a&#xff1a;\u4fee\u6539\u5b8c\u6210\u540e&#xff0c;\u522b\u5fd8\u4e86\u8fd0\u884c\u7ec8\u7aef\u547d\u4ee4 flutter pub get \u6765\u4e0b\u8f7d\u4f9d\u8d56&#xff01;<\/p>\n<h5>&#x1f476; \u65b0\u624b\u5c0f\u8bfe\u5802&#xff1a;\u4e3a\u4ec0\u4e48\u901a\u8fc7 Git \u5f15\u5165&#xff1f;<\/h5>\n<p>\u901a\u5e38\u6211\u4eec\u4f7f\u7528 pub.dev \u4e0a\u7684\u5e93&#xff0c;\u4f46\u7531\u4e8e\u9e3f\u8499\u9002\u914d\u7248\u672c\u76ee\u524d\u8fd8\u5904\u4e8e\u65e9\u671f\u9636\u6bb5\u6216\u7531\u793e\u533a\u7ef4\u62a4&#xff0c;\u53ef\u80fd\u5c1a\u672a\u5408\u5e76\u5230\u5b98\u65b9\u4e3b\u4ed3\u5e93\u6216\u53d1\u5e03\u5230\u516c\u5171\u4ed3\u5e93\u3002 \u56e0\u6b64&#xff0c;\u6211\u4eec\u9700\u8981\u4f7f\u7528 git \u65b9\u5f0f\u76f4\u63a5\u6307\u5411\u4ee3\u7801\u4ed3\u5e93\u548c\u7279\u5b9a\u7684\u5206\u652f (ref)&#xff0c;\u8fd9\u6837\u5c31\u80fd\u62a2\u5148\u4f53\u9a8c\u9002\u914d\u540e\u7684\u529f\u80fd\u5566&#xff01;<\/p>\n<hr \/>\n<h3>&#x1f6e0;\ufe0f 2. \u6838\u5fc3\u529f\u80fd\u5b9e\u73b0&#xff1a;lib\/file_selector_demo.dart<\/h3>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u5168\u65b0\u7684\u6587\u4ef6 lib\/file_selector_demo.dart&#xff0c;\u7528\u4e8e\u96c6\u4e2d\u5b9e\u73b0\u6587\u4ef6\u9009\u62e9\u548c\u9884\u89c8\u7684\u6838\u5fc3\u903b\u8f91\u3002<\/p>\n<h4>2.1 \u5bfc\u5165\u5fc5\u8981\u7684\u5305<\/h4>\n<p>\u6587\u4ef6&#xff1a;lib\/file_selector_demo.dart<\/p>\n<p>\u6211\u4eec\u9700\u8981\u5bfc\u5165 file_selector \u5e93\u4ee5\u53ca\u7528\u4e8e\u5904\u7406\u4e8c\u8fdb\u5236\u6570\u636e\u7684 dart:typed_data\u3002<\/p>\n<p>  #mermaid-svg-9bcB5HR8UczYbfYa{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-9bcB5HR8UczYbfYa .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-9bcB5HR8UczYbfYa .error-icon{fill:#552222;}#mermaid-svg-9bcB5HR8UczYbfYa .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-9bcB5HR8UczYbfYa .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-9bcB5HR8UczYbfYa .marker{fill:#333333;stroke:#333333;}#mermaid-svg-9bcB5HR8UczYbfYa .marker.cross{stroke:#333333;}#mermaid-svg-9bcB5HR8UczYbfYa svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-9bcB5HR8UczYbfYa p{margin:0;}#mermaid-svg-9bcB5HR8UczYbfYa .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-9bcB5HR8UczYbfYa .cluster-label text{fill:#333;}#mermaid-svg-9bcB5HR8UczYbfYa .cluster-label span{color:#333;}#mermaid-svg-9bcB5HR8UczYbfYa .cluster-label span p{background-color:transparent;}#mermaid-svg-9bcB5HR8UczYbfYa .label text,#mermaid-svg-9bcB5HR8UczYbfYa span{fill:#333;color:#333;}#mermaid-svg-9bcB5HR8UczYbfYa .node rect,#mermaid-svg-9bcB5HR8UczYbfYa .node circle,#mermaid-svg-9bcB5HR8UczYbfYa .node ellipse,#mermaid-svg-9bcB5HR8UczYbfYa .node polygon,#mermaid-svg-9bcB5HR8UczYbfYa .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-9bcB5HR8UczYbfYa .rough-node .label text,#mermaid-svg-9bcB5HR8UczYbfYa .node .label text,#mermaid-svg-9bcB5HR8UczYbfYa .image-shape .label,#mermaid-svg-9bcB5HR8UczYbfYa .icon-shape .label{text-anchor:middle;}#mermaid-svg-9bcB5HR8UczYbfYa .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-9bcB5HR8UczYbfYa .rough-node .label,#mermaid-svg-9bcB5HR8UczYbfYa .node .label,#mermaid-svg-9bcB5HR8UczYbfYa .image-shape .label,#mermaid-svg-9bcB5HR8UczYbfYa .icon-shape .label{text-align:center;}#mermaid-svg-9bcB5HR8UczYbfYa .node.clickable{cursor:pointer;}#mermaid-svg-9bcB5HR8UczYbfYa .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-9bcB5HR8UczYbfYa .arrowheadPath{fill:#333333;}#mermaid-svg-9bcB5HR8UczYbfYa .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-9bcB5HR8UczYbfYa .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-9bcB5HR8UczYbfYa .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-9bcB5HR8UczYbfYa .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-9bcB5HR8UczYbfYa .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-9bcB5HR8UczYbfYa .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-9bcB5HR8UczYbfYa .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-9bcB5HR8UczYbfYa .cluster text{fill:#333;}#mermaid-svg-9bcB5HR8UczYbfYa .cluster span{color:#333;}#mermaid-svg-9bcB5HR8UczYbfYa div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-9bcB5HR8UczYbfYa .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-9bcB5HR8UczYbfYa rect.text{fill:none;stroke-width:0;}#mermaid-svg-9bcB5HR8UczYbfYa .icon-shape,#mermaid-svg-9bcB5HR8UczYbfYa .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-9bcB5HR8UczYbfYa .icon-shape p,#mermaid-svg-9bcB5HR8UczYbfYa .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-9bcB5HR8UczYbfYa .icon-shape rect,#mermaid-svg-9bcB5HR8UczYbfYa .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-9bcB5HR8UczYbfYa .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-9bcB5HR8UczYbfYa .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-9bcB5HR8UczYbfYa :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>\u8c03\u7528 openFile<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>Platform Channel<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>\u5524\u8d77<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>\u7528\u6237\u9009\u62e9\u6587\u4ef6<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>\u8fd4\u56de\u6587\u4ef6\u4fe1\u606f<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>readAsBytes<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>Image.memory<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u7528\u6237\u70b9\u51fb\u9009\u62e9<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Flutter \u5e94\u7528<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u9e3f\u8499\u539f\u751f\u7cfb\u7edf<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u7cfb\u7edf\u6587\u4ef6\u9009\u62e9\u5668<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u8bfb\u53d6\u6587\u4ef6\u6d41<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u5c55\u793a\u56fe\u7247<\/p>\n<p><\/span><\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;package:flutter\/material.dart&#039;<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;package:file_selector\/file_selector.dart&#039;<\/span><\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ &#x1f448; \u6838\u5fc3\u5e93<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;dart:typed_data&#039;<\/span><\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ &#x1f448; \u7528\u4e8e\u5904\u7406\u6587\u4ef6\u6d41<\/span><\/p>\n<h4>2.2 \u5b9e\u73b0\u5355\u56fe\u9009\u62e9\u529f\u80fd<\/h4>\n<p>\u6587\u4ef6&#xff1a;lib\/file_selector_demo.dart<\/p>\n<p>\u6211\u4eec\u5728 _FileSelectorDemoPageState \u7c7b\u4e2d\u5b9a\u4e49 _pickImage \u65b9\u6cd5\u3002\u4f7f\u7528 XTypeGroup \u9650\u5236\u6587\u4ef6\u7c7b\u578b&#xff0c;\u5e76\u8c03\u7528 openFile \u9009\u62e9\u5355\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>  <span class=\"token class-name\">XFile<\/span><span class=\"token operator\">?<\/span> _singleImage<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7528\u4e8e\u5b58\u50a8\u5355\u9009\u7ed3\u679c<\/span><\/p>\n<p>  <span class=\"token class-name\">Future<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> <span class=\"token function\">_pickImage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5b9a\u4e49\u5141\u8bb8\u9009\u62e9\u7684\u6587\u4ef6\u7c7b\u578b&#xff08;\u56fe\u7247&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">XTypeGroup<\/span> typeGroup <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">XTypeGroup<\/span><span class=\"token punctuation\">(<\/span><br \/>\n      label<span class=\"token punctuation\">:<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;images&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span><br \/>\n      extensions<span class=\"token punctuation\">:<\/span> <span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">[<\/span><span class=\"token string-literal\"><span class=\"token string\">&#039;jpg&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;png&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;gif&#039;<\/span><\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ &#x1f680; \u8c03\u7528 openFile \u5524\u8d77\u6587\u4ef6\u9009\u62e9\u5668<\/span><br \/>\n    <span class=\"token keyword\">final<\/span> <span class=\"token class-name\">XFile<\/span><span class=\"token operator\">?<\/span> file <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> <span class=\"token function\">openFile<\/span><span class=\"token punctuation\">(<\/span>acceptedTypeGroups<span class=\"token punctuation\">:<\/span> <span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">XTypeGroup<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">[<\/span>typeGroup<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>file <span class=\"token operator\">!&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token function\">setState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        _singleImage <span class=\"token operator\">&#061;<\/span> file<span class=\"token punctuation\">;<\/span><br \/>\n        _multiImages <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6e05\u9664\u591a\u9009\u72b6\u6001<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203012437-69814e551acf6.png\" alt=\"image-20260202232306070\" \/><\/p>\n<h4>2.3 \u5b9e\u73b0\u591a\u56fe\u9009\u62e9\u529f\u80fd<\/h4>\n<p>\u6587\u4ef6&#xff1a;lib\/file_selector_demo.dart<\/p>\n<p>\u7c7b\u4f3c\u5730&#xff0c;\u5b9a\u4e49 _pickMultiImages \u65b9\u6cd5&#xff0c;\u8c03\u7528 openFiles \u63a5\u53e3\u5b9e\u73b0\u6279\u91cf\u9009\u62e9\u3002<\/p>\n<p>  <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">XFile<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> _multiImages <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7528\u4e8e\u5b58\u50a8\u591a\u9009\u7ed3\u679c<\/span><\/p>\n<p>  <span class=\"token class-name\">Future<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> <span class=\"token function\">_pickMultiImages<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">XTypeGroup<\/span> typeGroup <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">XTypeGroup<\/span><span class=\"token punctuation\">(<\/span><br \/>\n      label<span class=\"token punctuation\">:<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;images&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span><br \/>\n      extensions<span class=\"token punctuation\">:<\/span> <span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">[<\/span><span class=\"token string-literal\"><span class=\"token string\">&#039;jpg&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;png&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;gif&#039;<\/span><\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ &#x1f680; \u8c03\u7528 openFiles \u9009\u62e9\u591a\u4e2a\u6587\u4ef6<\/span><br \/>\n    <span class=\"token keyword\">final<\/span> <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">XFile<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> files <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> <span class=\"token function\">openFiles<\/span><span class=\"token punctuation\">(<\/span>acceptedTypeGroups<span class=\"token punctuation\">:<\/span> <span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">XTypeGroup<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">[<\/span>typeGroup<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>files<span class=\"token punctuation\">.<\/span>isNotEmpty<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token function\">setState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        _multiImages <span class=\"token operator\">&#061;<\/span> files<span class=\"token punctuation\">;<\/span><br \/>\n        _singleImage <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6e05\u9664\u5355\u9009\u72b6\u6001<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203012437-69814e55d7b0d.png\" alt=\"image-20260202232426485\" \/><\/p>\n<h4>2.4 \u5b9e\u73b0\u56fe\u7247\u9884\u89c8&#xff08;\u2728 \u5173\u952e\u70b9&#xff09;<\/h4>\n<p>\u6587\u4ef6&#xff1a;lib\/file_selector_demo.dart<\/p>\n<p>\u5728\u9e3f\u8499\u7cfb\u7edf\u4e0a&#xff0c;\u7531\u4e8e\u6587\u4ef6\u6c99\u7bb1\u673a\u5236\u7684\u5dee\u5f02&#xff0c;\u63a8\u8350\u4f7f\u7528\u6587\u4ef6\u6d41&#xff08;Bytes&#xff09;\u7684\u65b9\u5f0f\u6765\u52a0\u8f7d\u56fe\u7247&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u4f7f\u7528\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<h5>&#x1f476; \u65b0\u624b\u5c0f\u8bfe\u5802&#xff1a;\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u76f4\u63a5\u7528\u6587\u4ef6\u8def\u5f84&#xff1f;<\/h5>\n<p>\u5728 Android \u6216 iOS \u4e0a&#xff0c;\u6211\u4eec\u6709\u65f6\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u6587\u4ef6\u8def\u5f84&#xff08;\u5982 \/storage\/emulated\/0\/&#8230;&#xff09;\u8bbf\u95ee\u6587\u4ef6\u3002 \u4f46\u5728\u9e3f\u8499&#xff08;\u4ee5\u53ca\u73b0\u4ee3\u79fb\u52a8\u7cfb\u7edf&#xff09;\u7684\u4e25\u683c\u6c99\u7bb1\u673a\u5236\u4e0b&#xff0c;\u5e94\u7528\u53ea\u80fd\u8bbf\u95ee\u81ea\u5df1\u201c\u79c1\u6709\u9886\u5730\u201d\u5185\u7684\u6587\u4ef6\u3002\u7cfb\u7edf\u9009\u62e9\u5668\u8fd4\u56de\u7684\u8def\u5f84\u53ef\u80fd\u662f\u4e00\u4e2a\u865a\u62df\u8def\u5f84\u6216\u6ca1\u6709\u76f4\u63a5\u8bfb\u53d6\u6743\u9650\u3002 \u4f7f\u7528 readAsBytes() \u5c31\u50cf\u662f\u7528\u4e00\u6839\u5438\u7ba1\u76f4\u63a5\u628a\u6587\u4ef6\u5185\u5bb9\u201c\u5438\u201d\u51fa\u6765&#xff0c;\u800c\u4e0d\u9700\u8981\u5173\u5fc3\u6587\u4ef6\u5177\u4f53\u653e\u5728\u54ea&#xff0c;\u8fd9\u6837\u65e2\u5b89\u5168\u53c8\u901a\u7528&#xff01;<\/p>\n<p>\u6211\u4eec\u4f7f\u7528 FutureBuilder \u914d\u5408 file.readAsBytes() \u6765\u5b9e\u73b0\u9884\u89c8&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u5355\u56fe\u9884\u89c8\u793a\u4f8b<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>_singleImage <span class=\"token operator\">!&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">[<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">Text<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-literal\"><span class=\"token string\">&#039;Selected Image:&#039;<\/span><\/span><span class=\"token punctuation\">,<\/span> style<span class=\"token punctuation\">:<\/span> <span class=\"token class-name\">TextStyle<\/span><span class=\"token punctuation\">(<\/span>fontWeight<span class=\"token punctuation\">:<\/span> <span class=\"token class-name\">FontWeight<\/span><span class=\"token punctuation\">.<\/span>bold<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token class-name\">FutureBuilder<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Uint8List<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><br \/>\n    future<span class=\"token punctuation\">:<\/span> _singleImage<span class=\"token operator\">!<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">readAsBytes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token comment\">\/\/ &#x1f448; \u5173\u952e&#xff1a;\u8bfb\u53d6\u6587\u4ef6\u6d41<\/span><br \/>\n    builder<span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">(<\/span>context<span class=\"token punctuation\">,<\/span> snapshot<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>snapshot<span class=\"token punctuation\">.<\/span>connectionState <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token class-name\">ConnectionState<\/span><span class=\"token punctuation\">.<\/span>done <span class=\"token operator\">&amp;&amp;<\/span> snapshot<span class=\"token punctuation\">.<\/span>data <span class=\"token operator\">!&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u4f7f\u7528 Image.memory \u5c55\u793a\u56fe\u7247<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token class-name\">Image<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">memory<\/span><span class=\"token punctuation\">(<\/span><br \/>\n          snapshot<span class=\"token punctuation\">.<\/span>data<span class=\"token operator\">!<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          height<span class=\"token punctuation\">:<\/span> <span class=\"token number\">200<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>snapshot<span class=\"token punctuation\">.<\/span>hasError<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">Text<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-literal\"><span class=\"token string\">&#039;Error loading image&#039;<\/span><\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">CircularProgressIndicator<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token class-name\">Text<\/span><span class=\"token punctuation\">(<\/span>_singleImage<span class=\"token operator\">!<\/span><span class=\"token punctuation\">.<\/span>path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token comment\">\/\/ \u663e\u793a\u8def\u5f84\u4ec5\u4f9b\u53c2\u8003<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203012438-69814e5693ccc.png\" alt=\"image-20260202232459168\" \/><\/p>\n<hr \/>\n<h3>&#x1f680; 3. \u914d\u7f6e\u5e94\u7528\u5165\u53e3&#xff1a;lib\/main.dart<\/h3>\n<p>\u6700\u540e&#xff0c;\u6211\u4eec\u5728\u5e94\u7528\u7684\u4e3b\u9875\u6dfb\u52a0\u5165\u53e3&#xff0c;\u8df3\u8f6c\u5230\u6211\u4eec\u521a\u521a\u5199\u7684\u6f14\u793a\u9875\u9762\u3002<\/p>\n<p>\u4fee\u6539\u6587\u4ef6&#xff1a;lib\/main.dart<\/p>\n<p>\u64cd\u4f5c&#xff1a;<\/p>\n<li>\u5bfc\u5165\u6f14\u793a\u9875\u9762\u6587\u4ef6\u3002<\/li>\n<li>\u5728 MyHomePage \u7684 Column \u4e2d\u6dfb\u52a0\u4e00\u4e2a\u6309\u94ae\u3002<\/li>\n<p><span class=\"token comment\">\/\/ 1. \u5bfc\u5165\u5934\u6587\u4ef6<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;file_selector_demo.dart&#039;<\/span><\/span><span class=\"token punctuation\">;<\/span> <\/p>\n<p><span class=\"token comment\">\/\/ &#8230;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ 2. \u5728 build \u65b9\u6cd5\u4e2d\u6dfb\u52a0\u8df3\u8f6c\u6309\u94ae<\/span><br \/>\n<span class=\"token class-name\">ElevatedButton<\/span><span class=\"token punctuation\">(<\/span><br \/>\n  onPressed<span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">Navigator<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span><br \/>\n      context<span class=\"token punctuation\">,<\/span><br \/>\n      <span class=\"token class-name\">MaterialPageRoute<\/span><span class=\"token punctuation\">(<\/span>builder<span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">(<\/span>context<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">FileSelectorDemoPage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  child<span class=\"token punctuation\">:<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">Text<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-literal\"><span class=\"token string\">&#039;Go to File Selector Demo&#039;<\/span><\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><\/p>\n<hr \/>\n<h3>&#x1f389; \u7ed3\u8bed<\/h3>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u4e09\u4e2a\u6587\u4ef6\u7684\u7b80\u5355\u914d\u7f6e&#xff0c;\u6211\u4eec\u5c31\u5b8c\u6210\u4e86 file_selector \u5728\u9e3f\u8499\u7cfb\u7edf\u4e0a\u7684\u96c6\u6210&#xff01;&#x1f680;<\/p>\n<ul>\n<li>pubspec.yaml&#xff1a;\u5f15\u5165\u201c\u5165\u573a\u5238\u201d\u3002<\/li>\n<li>lib\/file_selector_demo.dart&#xff1a;\u642d\u5efa\u201c\u821e\u53f0\u201d&#xff0c;\u5b9e\u73b0\u9009\u62e9\u4e0e\u9884\u89c8\u3002<\/li>\n<li>lib\/main.dart&#xff1a;\u6253\u5f00\u201c\u5927\u95e8\u201d&#xff0c;\u8fde\u63a5\u65b0\u529f\u80fd\u3002<\/li>\n<\/ul>\n<p>\u5feb\u53bb\u8fd0\u884c\u4f60\u7684\u9e3f\u8499\u5e94\u7528\u8bd5\u8bd5\u5427&#xff01;Happy Coding! &#x1f4bb;\u26a1\ufe0f &#x1f389; \u795d\u4f60\u5f00\u53d1\u987a\u5229&#xff01; &#x1f680; \u6b22\u8fce\u52a0\u5165\u5f00\u6e90\u9e3f\u8499\u8de8\u5e73\u53f0\u793e\u533a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u597d&#xff01;&#x1f44b; \u6b22\u8fce\u6765\u5230\u8fd9\u7bc7\u5173\u4e8e file_selector \u5728 HarmonyOS (OpenHarmony) \u4e0a\u4f7f\u7528\u7684\u5b9e\u6218\u6559\u7a0b\u3002 &#xfffd; 1. \u5f15\u5165\u4f9d\u8d56&#xff1a;pubspec.yaml<br \/>\n\u9996\u5148&#xff0c;\u6211\u4eec\u9700\u8981\u5728\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u5f15\u5165\u9002\u914d\u540e\u7684 file_selector \u5e93\u3002<br \/>\n\u4fee\u6539\u6587\u4ef6&#xff1a;pubspec.yaml<br \/>\n\u64cd\u4f5c&#xff1a;\u5728 dependencies \u8282\u70b9\u4e0b\u6dfb\u52a0 file_selector \u7684 gi<\/p>\n","protected":false},"author":2,"featured_media":71138,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2878,280,67],"topic":[],"class_list":["post-71141","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-flutter","tag-harmonyos","tag-67"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/71141.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4f60\u597d&#xff01;&#x1f44b; \u6b22\u8fce\u6765\u5230\u8fd9\u7bc7\u5173\u4e8e file_selector \u5728 HarmonyOS (OpenHarmony) \u4e0a\u4f7f\u7528\u7684\u5b9e\u6218\u6559\u7a0b\u3002 &#xfffd; 1. \u5f15\u5165\u4f9d\u8d56&#xff1a;pubspec.yaml \u9996\u5148&#xff0c;\u6211\u4eec\u9700\u8981\u5728\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u5f15\u5165\u9002\u914d\u540e\u7684 file_selector \u5e93\u3002 \u4fee\u6539\u6587\u4ef6&#xff1a;pubspec.yaml \u64cd\u4f5c&#xff1a;\u5728 dependencies \u8282\u70b9\u4e0b\u6dfb\u52a0 file_selector \u7684 gi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/71141.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-03T01:24:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203012437-69814e551acf6.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/71141.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/71141.html\",\"name\":\"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-03T01:24:39+00:00\",\"dateModified\":\"2026-02-03T01:24:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/71141.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/71141.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/71141.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/71141.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4f60\u597d&#xff01;&#x1f44b; \u6b22\u8fce\u6765\u5230\u8fd9\u7bc7\u5173\u4e8e file_selector \u5728 HarmonyOS (OpenHarmony) \u4e0a\u4f7f\u7528\u7684\u5b9e\u6218\u6559\u7a0b\u3002 &#xfffd; 1. \u5f15\u5165\u4f9d\u8d56&#xff1a;pubspec.yaml \u9996\u5148&#xff0c;\u6211\u4eec\u9700\u8981\u5728\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u5f15\u5165\u9002\u914d\u540e\u7684 file_selector \u5e93\u3002 \u4fee\u6539\u6587\u4ef6&#xff1a;pubspec.yaml \u64cd\u4f5c&#xff1a;\u5728 dependencies \u8282\u70b9\u4e0b\u6dfb\u52a0 file_selector \u7684 gi","og_url":"https:\/\/www.wsisp.com\/helps\/71141.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-03T01:24:39+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203012437-69814e551acf6.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/71141.html","url":"https:\/\/www.wsisp.com\/helps\/71141.html","name":"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-03T01:24:39+00:00","dateModified":"2026-02-03T01:24:39+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/71141.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/71141.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/71141.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6211\u8fd9\u6837\u7528\u9e3f\u8499\u5316Flutter\u4e09\u65b9\u5e93file_selector\u5b9e\u73b0\u5355\u56fe\u7247\u548c\u591a\u56fe\u7247\u9009\u62e9"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/71141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=71141"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/71141\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/71138"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=71141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=71141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=71141"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=71141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}