There are two pages in my flutter app. In one page I check if data exist in SQLite database, that data loaded to the page and if not, data get from API and display. The procedure of the second page also likes the first page.

First Page


class NewsBloc extends BlocBase<NewsStreams, NewsEvents> {
  final NoticeRepository repository;

  DatabaseHelper helper = DatabaseHelper();

  int _page = 0;
  int _limit = 20;
  int _currentCategory;
  Map _categories = Map();
  String searchCat;
  String category;

  List<String> _categoriesNamesSearch = List();
  List<String> _categoriesNames = List();
  List _newsInner = List();

  bool _fnish = true;
  bool _first = true;

  NewsBloc(this.repository) {}

  @override
  void initView() async {
    List categories = await helper.getCategoryList();

    if (categories.isNotEmpty && categories.length > 0) {
      for (var i = 0; i < categories.length; i++) {
        if (categories[i].name == 'සියල්ල') {
          _categoriesNamesSearch.add(categories[i].id);

          _categoriesNames.add(categories[i].name);
          _categories[categories[i].id] = categories[i].name;
          _currentCategory = 0;
        }
      }

      for (var i = 0; i < categories.length; i++) {
        if (categories[i].name != 'සියල්ල') {
          _categoriesNamesSearch.add(categories[i].id);

          _categoriesNames.add(categories[i].name);
          _categories[categories[i].id] = categories[i].name;

        }
      }
      streams.categoriesName.set(_categoriesNames);
      _load(false);

      var categoriesA = await repository.getAllCategory();

      await helper.deleteCategory();
      _categoriesNames = List();
      _categoriesNamesSearch = List();
      for (var i = 0; i < categoriesA.length; i++) {
        await helper.insertCategory(categoriesA[i]);

        if (categoriesA[i].name == 'සියල්ල') {
          _categoriesNamesSearch.add(categoriesA[i].id);

          _categoriesNames.add(categoriesA[i].name);
          _categories[categoriesA[i].id] = categoriesA[i].name;
          _currentCategory = 0;
        }
      }

      for (var i = 0; i < categoriesA.length; i++) {
        if (categoriesA[i].name != 'සියල්ල') {
          _categoriesNamesSearch.add(categoriesA[i].id);

          _categoriesNames.add(categoriesA[i].name);
          _categories[categoriesA[i].id] = categoriesA[i].name;

        }
      }
      streams.categoriesName.set(_categoriesNames);
    } else {
      var categories = await repository.getAllCategory();

      await helper.deleteCategory();
      _categoriesNames = List();
      _categoriesNamesSearch = List();
      for (var i = 0; i < categories.length; i++) {
        await helper.insertCategory(categories[i]);

        if (categories[i].name == 'සියල්ල') {
          _categoriesNamesSearch.add(categories[i].id);

          _categoriesNames.add(categories[i].name);
          _categories[categories[i].id] = categories[i].name;
          _currentCategory = 0;
        }
      }

      for (var i = 0; i < categories.length; i++) {
        if (categories[i].name != 'සියල්ල') {
          _categoriesNamesSearch.add(categories[i].id);

          _categoriesNames.add(categories[i].name);
          _categories[categories[i].id] = categories[i].name;

        }
      }
      streams.categoriesName.set(_categoriesNames);
      _load(false);
    }

  }

  @override
  void eventReceiver(event) async {
    if (event is LoadNews) {
      streams.progress.set(false);
      _first = true;
      _load(false);
    }

    if (event is LoadMoreNews) {

      if (_fnish == true) {
        streams.progress.set(false);
        _fnish = false;
        _load(true);
      }
    }

    if (event is ClickCategory) {

      _newsInner = [];
      _currentCategory = event.data;
      cleanList();
      streams.progress.set(false);
      _load(false);
    }
  }

  _load(bool isMore) async {
    try {

      if (isMore) {
        _page += _limit;
      } else {
        _page = 0;
      }

      streams.errorConection.set(false);

      category = _categoriesNames[_currentCategory];

      searchCat = _categoriesNamesSearch[_currentCategory];

      String toDay = new DateTime.now().toUtc().toIso8601String();

      if (category != 'සියල්ල') {

        var allNws = await helper.getNewsList(searchCat);

        if (_first == true && allNws.length > 0) {
          _showNews(allNws, false);
        }

        streams.progress.set(true);

        var newsSche = await repository.getNewsCat(
            toDay, _page.toString(), searchCat, _limit.toString());

        if (newsSche.length > 0) {
          await helper.deleteNews(_limit);
        }
        if (newsSche.length > 0) {
          for (var i = 0; i < newsSche.length; i++) {
            if (!_newsInner.contains(newsSche[i])) {
              await helper.insertNote(newsSche[i]);
            }
          }
          var allNwsB = await helper.getNewsList(searchCat);
          if (_first == true) {
            _showNews(allNwsB, false);
          } else {
            _showNews(allNwsB, true);
          }

        } else {
          streams.progress.set(false);
        }

        _fnish = true;
        _first = false;

      } else {
        var allNws = await helper.getNewsListNoCat();

        if (_first == true && allNws.length > 0) {
          _showNews(allNws, false);
        }

        streams.progress.set(true);

        var newsSche = await repository.getNewsAll(
            toDay, _page.toString(), _limit.toString());

        if (newsSche.length > 0) {
          await helper.deleteNews(_limit);
        }

        if (newsSche.length > 0) {

          for (var i = 0; i < newsSche.length; i++) {
            if (!_newsInner.contains(newsSche[i])) {
              await helper.insertNote(newsSche[i]);
            }

          }

          var allNwsB = await helper.getNewsListNoCat();
          if (_first == true) {
            _showNews(allNwsB, false);
          } else {
            _showNews(allNwsB, true);
          }
        } else {
          streams.progress.set(false);
        }

        _fnish = true;
        _first = false;

      }

    } catch (e) {
      print("Error$e");
    }
  }

  _showNews(List news, bool isMore) async {
    if (isMore) {
      _newsInner.addAll(news);
    } else {
      _newsInner = news;
    }
    _newsInner.sort((a, b) => b.createdAt.compareTo(a.createdAt));

    if (category != 'සියල්ල') {
       var allNewss = List();
      for (var i = 0; i < _newsInner.length; i++) {
        if (_newsInner[i].parseCategory.runtimeType != String) {
          if (_newsInner[i].parseCategory.id == searchCat) {
            if (!allNewss.contains(_newsInner[i])) {
              allNewss.add(_newsInner[i]);
            }
          }
        } else{
          if(_newsInner[i].parseCategory == searchCat){
            if (!allNewss.contains(_newsInner[i])) {
              allNewss.add(_newsInner[i]);
            }
          }
        }
      }
      streams.noticies.set(allNewss);
    } else {
      var allNewss = List();
      for (var i = 0; i < _newsInner.length; i++) {
        if (_newsInner[i].parseCategory.runtimeType != String) {

            if (!allNewss.contains(_newsInner[i])) {
              allNewss.add(_newsInner[i]);
            }

        } else{

            if (!allNewss.contains(_newsInner[i])) {
              allNewss.add(_newsInner[i]);
            }

        }
      }
      streams.noticies.set(allNewss);
    }
    streams.progress.set(false);

  }

  _showImplError(onError) {
    print(onError);
    if (onError is FetchDataException) {
      print("codigo: ${onError.code()}");
    }
    streams.errorConection.set(true);
    streams.progress.set(false);

  }

  void cleanList() {
    _newsInner = List();
    streams.noticies.set(_newsInner);
  }
}

Second Page


class CartoonBloc extends BlocBase<CartoonStreams, CartoonEvents> {
  final NoticeRepository repository;
  DatabaseHelper helper = DatabaseHelper();
  int _page = 0;
  int _limit = 10;

  List _cartoonInner = List();
  List _cartoonAll = List();
  bool _carregando = false;
  bool _fnish = true;
  bool _first = true;

  CartoonBloc(this.repository) {

  }

  @override
  void initView() {
    _load(false);
  }

  @override
  void eventReceiver(event) {
    if (event is LoadCartoon) {
      _load(false);
    }

    if (event is LoadMoreCartoon) {
      if (_fnish == true) {
        streams.progress.set(false);
        _fnish = false;
        _first = false;
        _load(true);
      }
    }

  }

  _load(bool isMore) async {
    _carregando = true;

    if (isMore) {
      _page += _limit;
    } else {
      _page = 0;
    }

    streams.errorConection.set(false);

    String toDay = new DateTime.now().toUtc().toIso8601String();

    var allCton = await helper.getCartoonList();

    if (_first == true && allCton.length > 0) {
      _showCartoon(allCton, false);
    }

    streams.progress.set(true);

    var cartoonSche = await repository.getAllCartoonSche(
        toDay, _page.toString(), _limit.toString());

    if (cartoonSche.length > 0) {
        await helper.deleteCartoon(_limit);
      }

    if (cartoonSche.length > 0) {

      for (var i = 0; i < cartoonSche.length; i++) {
         if (!_cartoonInner.contains(cartoonSche[i])) {
              await helper.insertCartoon(cartoonSche[i]);
            }

      }

      var allNwsB = await helper.getCartoonList();

      if(_first == true){
            _showCartoon(allNwsB, false);
          } else{
            _showCartoon(allNwsB, true);
          }

    } else {
      streams.progress.set(false);
    }

    _fnish = true;
    _first = false;

  }

  _showCartoon(List cartoon, bool isMore) {
    streams.progress.set(false);

    if (isMore) {
      _cartoonInner.addAll(cartoon);
    } else {
      _cartoonInner = cartoon;
    }

    streams.cartoons.set(_cartoonInner);

    _carregando = false;
  }

  _showImplError(onError) {
    print(onError);
    if (onError is FetchDataException) {
      print("codigo: ${onError.code()}");
    }
    streams.errorConection.set(true);
    streams.progress.set(false);
    _carregando = false;
  }

  void cleanList() {
    _cartoonInner = List();
    streams.cartoons.set(_cartoonInner);
  }
}

My problem is when I build the app and add to the play store, and install to Redmi note7 phone first-page content is not loaded but second-page content is loaded This happens only for Redmi note 7 phones. Please help me to solve this issue