isSafeName static method
A name is written under the client's own directory, so one that climbs out of it, or is absolute, is refused before anything is written.
Implementation
static bool isSafeName(String name) =>
name.isNotEmpty &&
!name.startsWith('/') &&
!name.contains(r'\') &&
!name.split('/').any((String s) => s.isEmpty || s == '.' || s == '..');