OSSObject.key constructor

OSSObject.key(
  1. String key
)

Implementation

OSSObject.key(this.key):isDir = key[key.length-1] =='/'{
  //如果是文件夹就删除最后一位
  final substring = this.isDir? this.key.substring(0,this.key.length-1) :this.key;
  var separateIndex = substring.lastIndexOf("/");
  this.name = substring.substring(separateIndex==-1?0:separateIndex,substring.length);
  this.parentKey = substring.substring(0,separateIndex+1);
}