withAutoKeys static method

void withAutoKeys(
  1. GenerateCellKey? generateCellKey,
  2. void fn()
)

Register a callback used to generate keys for cells.

The function fn is called with generateCellKey in-effect as the generate cell key function, which is called whenever autoKey is called within fn.

Implementation

static void withAutoKeys(GenerateCellKey? generateCellKey, void Function() fn) {
  final previous = _generateKey;

  try {
    _generateKey = generateCellKey;
    fn();
  }
  finally {
    _generateKey = previous;
  }
}