Как убрать ошибку The argument type 'int?' can't be assigned to the parametr type 'num'?

import 'dart:math' as math;

double? totalWithoutDelivery(
  List<PrecartRecord> data,
  int index,
  DocumentReference currentUser,
) {
  var maxIndex = index;
  if (maxIndex == -1 || index >= data.length) {
    maxIndex = data.length - 1;
  }

  double total = 0;
  double totalWithoutDelivery = 0;
  for (var i = 0; i <= maxIndex; i++) {
    if (data[i].user == currentUser) {
      total == data[i].productPrice * data[i].productQuantity; 
      totalWithoutDelivery += total;
    }
    return totalWithoutDelivery..round;
  }
}

Ответы (0 шт):