fileOf method

PFile? fileOf(
  1. dynamic file, {
  2. String? name,
  3. int? size,
})

Implementation

PFile? fileOf(dynamic file, {String? name, int? size}) {
  assert(initialized,
      "Must be initialized first by calling PFile.initialize() somewhere in your init code");

  if (file == null) return null;
  for (var strategy in _strategies) {
    var res = strategy(file, name: name, size: size);
    if (res != null) {
      return res;
    }
  }
  throw "No strategy could extract file of type ${file.runtimeType}";
}