nylo-core / nylo

Nylo is the fastest way to build your next Flutter mobile app. Streamline your projects with Nylo's opinionated approach to building Flutter apps. Develop your next idea ⚡️
https://nylo.dev
MIT License
586 stars 58 forks source link

Ny pull to refresh #129

Closed jitendravn closed 4 months ago

jitendravn commented 4 months ago

while using your nypulltorefresh

ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: []("action")
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      NyState.stateUpdated (package:nylo_support/widgets/ny_state.dart:129:13)
#2      NyState.initState.<anonymous closure>.<anonymous closure> (package:nylo_support/widgets/ny_state.dart:94:17)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
#4      CastStreamSubscription._onData (dart:_internal/async_cast.dart:85:11)
#5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
#6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#8      _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#9      _WhereStream._handleData (dart:async/stream_pipe.dart:195:12)
#10     _ForwardingStreamSubscription._handleData (dart:as<…>
NyPullToRefresh(
                                  scrollDirection: Axis.horizontal,
                                  empty:
                                      Center(child: Text('No Articles yet.')),
                                  shrinkWrap: false,
                                  loading: Center(
                                    child: CircularProgressIndicator.adaptive(),
                                  ),
                                  physics: BouncingScrollPhysics(),
                                  onRefresh: () {
                                    _updateFeatureArticles();
                                  },
                                  child: (context, data) {
                                    return featureArticle(data);
                                  },
                                  data: (int iteration) async {
                                    var params = {
                                      'cat_id': catId,
                                      'is_featured': true,
                                      'page': iteration
                                    };
                                    List<Article> data =
                                        await api<ArticleApiService>(
                                      (request) async =>
                                          request.fetchArticles(query: params),
                                    );
                                    return data;
                                  },
                                  stateName: "feature_articles", ),

I think I have find the error but not solution

the error is in your NY State widget

stateUpdated(dynamic data) async {
    if (data['action'] == null) return;

    dynamic stateData = {};
    if (data['data'] != null) {
      stateData = data['data'];
    }
agordn52 commented 4 months ago

Hi @jitendravn, I'll take a look at this 👍

agordn52 commented 4 months ago

Hi @jitendravn,

I've pushed up a new version of nylo_framework 5.25.6, can you try that?

jitendravn commented 4 months ago

@agordn52 ok sir thanks, i will check this

agordn52 commented 4 months ago

I'll close this issue but if you continue to have issues let me know.

jitendravn commented 4 months ago

@agordn52 nhandled Exception: NoSuchMethodError: The method '[]' was called on null. Receiver: null

this is issues is gone

but not able refresh Nypulltorefresh state

jitendravn commented 4 months ago

@agordn52 Sir Please look at this

agordn52 commented 4 months ago

Hi @jitendravn,

You can use StateAction.refreshPage('YourNyPullToRefreshName');

Check out the docs to learn more.