defaultMMKV static method

MMKV defaultMMKV({
  1. String? cryptKey,
})

A generic purpose instance in single-process mode.

Note: If you come across to failing to load defaultMMKV() on Android after upgrading Flutter from 1.20+ to 2.0+, you can try passing this cryptKey '\u{2}U' instead.

var mmkv = MMKV.defaultMMKV(cryptKey: '\u{2}U');

Implementation

static MMKV defaultMMKV({String? cryptKey}) {
  final mmkv = MMKV("");
  final cryptKeyPtr = _string2Pointer(cryptKey);
  const mode = MMKVMode.SINGLE_PROCESS_MODE;
  mmkv._handle = _getDefaultMMKV(mode.index, cryptKeyPtr);
  calloc.free(cryptKeyPtr);
  return mmkv;
}