append method Null safety

String? append(
  1. String suffix
)

Appends a suffix to the String

Example

String foo = 'hello';
String newFoo = foo1.append(' world'); // returns 'hello world'

Implementation

String? append(String suffix) {
  if (this == null) {
    return null;
  }
  if (this!.isEmpty) {
    return this;
  }
  return this! + suffix;
}