commit method

void commit(
  1. void func(
    1. Diagram
    ), [
  2. String? tname
])

Starts a new transaction, calls the provided function, and commits the transaction. Code is called within a try-finally statement. If the function does not return normally, this rolls back the transaction rather than committing it. Example usage:

myDiagram.commit(d => d.remove(somePart), "Remove Part");

Note: passing null as the second argument will temporarily set Diagram#skipsUndoManager to true. It is commonplace to call this method with no second argument, which would commit a transaction with a transaction name that is the empty string. @param {Function} func the function to call as the transaction body @param {(string|null)=} tname a descriptive name for the transaction, or null to temporarily set #skipsUndoManager to true; if no string transaction name is given, an empty string is used as the transaction name @since 1.8

Implementation

void commit(
  void Function(_i3.Diagram) func, [
  _i2.String? tname,
]) {
  _i4.callMethod(
    this,
    'commit',
    [
      _i4.allowInterop(func),
      tname ?? _i5.undefined,
    ],
  );
}