canBeCombined method

Future<bool> canBeCombined()

canBeCombined returns true in case the event can be combined. This is often the case for key events that have never been combined.

Implementation

Future<bool> canBeCombined() async {
  if (type != FlutsterTestEventType.key) {
    return (false);
  }
  FlutsterTestEvent? previous = (await getRecord())?.findPreviousEvent(this);
  FlutsterTestEvent? next = (await getRecord())?.findNextEvent(this);
  if (previous == null && next == null) {
    return (false);
  }
  if ((previous?.type ?? FlutsterTestEventType.none) ==
      FlutsterTestEventType.key) {
    return (true);
  }
  if ((next?.type ?? FlutsterTestEventType.none) ==
      FlutsterTestEventType.key) {
    return (true);
  }
  return (false);
}