如何在Flutter中将文件保存到内部存储中

问题描述 投票:0回答:2

我正在尝试将文件保存在内部存储中,但没有成功。我正在关注this文档。 我还尝试将录制的音频文件保存在内部存储中。当我在设备中搜索保存文件时,无法到达那里。 下面的清单代码我已经使用了。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
package="com.example.untitled1">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<!--<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />-->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAG" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>

<application
    android:label="untitled1"
    android:name="${applicationName}"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>

请帮助我解决我的代码有什么问题。

flutter dart path flutter-dependencies dart-pub
2个回答
0
投票

看起来像这条线

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAG" />
应该
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />


0
投票

我认为将文件保存在内部存储中是非常规的,文件大多保存在外部存储(存储卡)中。

© www.soinside.com 2019 - 2024. All rights reserved.