title: Getting 'Script error' and can't find why
body: <p>I'm practicing a little bit in DartPad some problems and can't get the solution, the code below is what I think is OK, but I'm getting 'Script error' in the console.</p>
  <p>The problem that I'm solving is that I need to make function that has two arguments, first one in some random sentence and second is any character, and I need to find how many characters are in that sentence.</p>
  <p>Please respond with the error that I don't see or just give me solution. Ty</p>
  <pre><code>void main() {
    numberOfSameCharacters(randomString: 'Today is a nice day.', character: 'a');
  }
  
  void numberOfSameCharacters({String randomString, String character}) {
    int sameCharacters = 0;
  
    List&lt;String&gt; randomStringList = randomString.split('');
  
    for (int i = 0; i &lt;= randomStringList.length; i++) {
      if (character.toLowerCase() == randomStringList[i].toLowerCase()) {
        sameCharacters += 1;
      }
    }
  
    print(sameCharacters);
  }
  </code></pre>