putBool method

Future<void> putBool(
  1. String key,
  2. bool value
)

保存bool

Implementation

Future<void> putBool(String key, bool value) async {
  // obtain shared preferences
  final prefs = await SharedPreferences.getInstance();
  await prefs.setBool(key, value);
}