解决方案:
1.在flutter引入
shared_preferences: ^2.0.6
2.Add this code in your MainActivity
import android.content.Context import android.os.Bundle import androidx.annotation.NonNull import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin import io.flutter.plugins.videoplayer.* class MainActivity : FlutterActivity() { override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) flutterEngine.getPlugins().add(SharedPreferencesPlugin()) flutterEngine.getPlugins().add(VideoPlayerPlugin()) } }