next method

  1. @override
ResourceDetail next()
override

Implementation

@override
ResourceDetail next() {
  final _random = Random();

  if (type == ResourceType.video) {
    return VideoDetail(url: videoList[_random.nextInt(videoList.length)]);
  } else if (type == ResourceType.pic) {
    return ImageDetail(imageList[_random.nextInt(imageList.length)]);
  } else if (type == ResourceType.pics) {
    return ImageListDetail(imageList);
  }

  int randNum = _random.nextInt(30);

  if (randNum < 10) {
    return VideoDetail(url: videoList[_random.nextInt(videoList.length)]);
  } else if (randNum < 20) {
    return ImageDetail(imageList[_random.nextInt(imageList.length)]);
  } else if (randNum < 30) {
    return ImageListDetail(imageList);
  }
  return super.next();
}