isDynamicType function

bool isDynamicType(
  1. String typeName
)

Implementation

bool isDynamicType(String typeName) {
  if(typeName == 'bytes' || typeName == 'string') {
    return true;
  }

  var reg = RegExp(r"^([a-z\d\[\]\(\),]{1,})\[([\d]*)\]$");
  var match = reg.firstMatch(typeName);
  if(match != null) {
    var baseType = match.group(1);
    var repeatCount = match.group(2);
    if(repeatCount == "") {
      return true;
    }
    return isDynamicType(baseType!);
  }

  if(typeName.endsWith(')') && typeName.startsWith('(')) {
    var subTypes = typeName.substring(1, typeName.length - 1).split(',');
    for(var i = 0; i < subTypes.length; i++) {
      if(isDynamicType(subTypes[i])) {
        return true;
      }
    }
    return false;
  }
  return false;
}