Meu Código
String getFirstNome() {
String lastName = "";
String firstName = "";
if (nome!.split("\\w+").length >= 1) {
firstName = nome!.substring(0, nome!.indexOf(" "));
lastName = nome!.substring(nome!.lastIndexOf(" ") + 1);
return firstName + lastName;
} else {
firstName = nome.toString();
}
return firstName;
}