buildWidget method

BuildResult buildWidget(
  1. MathOptions options
)

This is where the actual widget building process happens.

This method tries to reduce widget rebuilds. Rebuild bypass is determined by the following process:

Implementation

BuildResult buildWidget(MathOptions options) {
  if (value is PositionDependentMixin) {
    (value as PositionDependentMixin).updatePos(pos);
  }

  if (value._oldOptions != null && options == value._oldOptions) {
    return value._oldBuildResult!;
  }
  final childOptions = value.computeChildOptions(options);

  final newChildBuildResults = _buildChildWidgets(childOptions);

  final bypassRebuild = value._oldOptions != null &&
      !value.shouldRebuildWidget(value._oldOptions!, options) &&
      listEquals(newChildBuildResults, value._oldChildBuildResults);

  value._oldOptions = options;
  value._oldChildBuildResults = newChildBuildResults;
  return bypassRebuild
      ? value._oldBuildResult!
      : (value._oldBuildResult =
          value.buildWidget(options, newChildBuildResults));
}