Home > Software design >  Flutter - How to split string by space in the stateful widget?
Flutter - How to split string by space in the stateful widget?

Time:04-04

I'm still new to coding and I don't know how to split string in the stateful widget.


CodePudding user response:

to split String str = "Hello World!";

you can simply use split method like str.split(' ')

Refer this official documentation.

CodePudding user response:

You can use String's .split() method to achieve this, passing in a string containing just a space as your delimiter. For example:

'Hello World'.split(' ') will return ['Hello', 'World'].

  • Related