wasabeef / flutter-architecture-blueprints

Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps.
MIT License
1.6k stars 258 forks source link

Doubled requests #81

Open fleshgakker opened 3 years ago

fleshgakker commented 3 years ago

Requests in this repo are doubled (being sent twice). For example fetchNews().

It's not "options" call. And I can see on two get requests on the API side (in case of change newsapi to custom) Log below from clean repo. First I/flutter (23841): ** Request I/flutter (23841): uri: https://newsapi.org/v2/everything?q=anim&from=2021-06-09&sortBy=publishedAt&language=en&apiKey=98c8df982b8b4da8b86cd70e851fc521 I/flutter (23841): method: GET** I/flutter (23841): responseType: ResponseType.json I/flutter (23841): followRedirects: true I/flutter (23841): connectTimeout: 30000 I/flutter (23841): sendTimeout: 30000 I/flutter (23841): receiveTimeout: 30000 I/flutter (23841): receiveDataWhenStatusError: true I/flutter (23841): extra: {} I/flutter (23841): headers: I/flutter (23841): User-Agent: FAB Dev/1.0.0-Dev (Android 11; sdk_gphone_x86_arm; generic_x86_arm; x86) I/flutter (23841): Sec-CH-UA-Arch: x86 I/flutter (23841): Sec-CH-UA-Model: sdk_gphone_x86_arm I/flutter (23841): Sec-CH-UA-Platform: Android I/flutter (23841): Sec-CH-UA-Platform-Version: 11 I/flutter (23841): Sec-CH-UA: "FAB Dev"; v="1.0.0-Dev" I/flutter (23841): Sec-CH-UA-Full-Version: 1.0.0-Dev I/flutter (23841): Sec-CH-UA-Mobile: ?1 I/flutter (23841): data: I/flutter (23841): {} I/flutter (23841):

First response I/flutter (23841): ** Response I/flutter (23841): uri: https://newsapi.org/v2/everything?q=anim&from=2021-06-09&sortBy=publishedAt&language=en&apiKey=98c8df982b8b4da8b86cd70e851fc521 I/flutter (23841): statusCode: 200** I/flutter (23841): headers: I/flutter (23841): connection: keep-alive I/flutter (23841): cache-control: no-cache I/flutter (23841): transfer-encoding: chunked I/flutter (23841): date: Wed, 07 Jul 2021 16:31:17 GMT I/flutter (23841): content-encoding: gzip I/flutter (23841): cf-cache-status: DYNAMIC I/flutter (23841): report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v2?s=QFym99f%2FD2ApRKAqXH%2FPjAoEj%2FShsb3LPRWcIyOb8iV9s1XjCRXxqFUmghIAgTwHb1MiHDGTXcC1RvPS30gZbPsDgmWsYWM2SFcr281dRf8%2BGQwKpOW4tA%3D%3D"}],"group":"cf-nel","max_age":604800} I/flutter (23841): pragma: no-cache I/flutter (23841): content-type: application/json; charset=utf-8 I/flutter (23841): expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" I/flutter (23841): x-cached-result: false I/flutter (23841): server: cloudflare I/flutter (23841): nel: {"report_to":"cf-nel","max_age":604800} I/flutter (23841): cf-ray: 66b2764f3c6024a1-KBP I/flutter (23841): expires: -1 I/flutter (23841): Response Text: I/flutter (23841): {"status":"ok","totalResults":66,"articles":[{"source":{"id":null,"name":"Nature.com"},"author":"Abdelfattah Selim, Hanem Khater, Hamdan I. Almohammed","title":"A recent update about seroprevalence of ovine neosporosis in Northern Egypt and its associated risk factors","description":"Neospora caninum (Family: Sarcocystidae) is an obligate intracellular protozoan. It is one of the most critical abortifacients in ruminants. The seroprevalence of antibodies against N. caninum and its risk factors was investigated among 430 sheep from four No…","url":"https://www.nature.com/articles/s41598-021-93596-9?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+srep%2Frss%2Fcurrent+%28Scientific+Reports%29","urlToImage":"https://media.springernature.com/m685/springer-static/image/art%3A10.1038%2Fs41598-021-93596-9/MediaObjects/41598_2021_93596_Fig1_HTML.png","publishedAt":"2021-07-07T00:00:00Z","content":"

  • 1.Selim, A. & Abdelhady, A. Neosporosis among Egyptian camels and its associated risk factors. Trop.

    Second: I/flutter (23841): ** Request I/flutter (23841): uri: https://newsapi.org/v2/everything?q=anim&from=2021-06-09&sortBy=publishedAt&language=en&apiKey=98c8df982b8b4da8b86cd70e851fc521 I/flutter (23841): method: GET** I/flutter (23841): responseType: ResponseType.json I/flutter (23841): followRedirects: true I/flutter (23841): connectTimeout: 30000 I/flutter (23841): sendTimeout: 30000 I/flutter (23841): receiveTimeout: 30000 I/flutter (23841): receiveDataWhenStatusError: true I/flutter (23841): extra: {} I/flutter (23841): headers: I/flutter (23841): User-Agent: FAB Dev/1.0.0-Dev (Android 11; sdk_gphone_x86_arm; generic_x86_arm; x86) I/flutter (23841): Sec-CH-UA-Arch: x86 I/flutter (23841): Sec-CH-UA-Model: sdk_gphone_x86_arm I/flutter (23841): Sec-CH-UA-Platform: Android I/flutter (23841): Sec-CH-UA-Platform-Version: 11 I/flutter (23841): Sec-CH-UA: "FAB Dev"; v="1.0.0-Dev" I/flutter (23841): Sec-CH-UA-Full-Version: 1.0.0-Dev I/flutter (23841): Sec-CH-UA-Mobile: ?1 I/flutter (23841): data: I/flutter (23841): {} I/flutter (23841):

    Second response: I/flutter (23841): ** Response I/flutter (23841): uri: https://newsapi.org/v2/everything?q=anim&from=2021-06-09&sortBy=publishedAt&language=en&apiKey=98c8df982b8b4da8b86cd70e851fc521 I/flutter (23841): statusCode: 200** I/flutter (23841): headers: I/flutter (23841): connection: keep-alive I/flutter (23841): cache-control: no-cache I/flutter (23841): transfer-encoding: chunked I/flutter (23841): date: Wed, 07 Jul 2021 16:31:17 GMT I/flutter (23841): content-encoding: gzip I/flutter (23841): cf-cache-status: DYNAMIC I/flutter (23841): report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v2?s=6M6lT3eWN3RxFno9EeyWeCMci7dTGUuGUO3gRMauf4iVa3l7P8PwKQ%2BESCwCUroMuqKQz2gcQ2u6jDlXAiJeF7R2q3RxChLvyl2QaIQKqS5wiPaPRlf2eg%3D%3D"}],"group":"cf-nel","max_age":604800} I/flutter (23841): pragma: no-cache I/flutter (23841): content-type: application/json; charset=utf-8 I/flutter (23841): expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" I/flutter (23841): x-cached-result: true I/flutter (23841): server: cloudflare I/flutter (23841): x-cache-remaining: 99 I/flutter (23841): nel: {"report_to":"cf-nel","max_age":604800} I/flutter (23841): cf-ray: 66b27654ada624a1-KBP I/flutter (23841): x-cache-expires: Wed, 07 Jul 2021 16:36:10 GMT I/flutter (23841): expires: -1 I/flutter (23841): Response Text: I/flutter (23841): {"status":"ok","totalResults":66,"articles":[{"source":{"id":null,"name":"Nature.com"},"author":"Abdelfattah Selim, Hanem Khater, Hamdan I. Almohammed","title":"A recent update about seroprevalence of ovine neosporosis in Northern Egypt and its associated risk factors","description":"Neospora caninum (Family: Sarcocystidae) is an obligate intracellular protozoan. It is one of the most critical abortifacients in ruminants. The seroprevalence of antibodies against N. caninum and its risk factors was investigated among 430 sheep from four No…","url":"https://www.nature.com/articles/s41598-021-93596-9?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+srep%2Frss%2Fcurrent+%28Scientific+Reports%29","urlToImage":"https://media.springernature.com/m685/springer-static/image/art%3A10.1038%2Fs41598-021-93596-9/MediaObjects/41598_2021_93596_Fig1_HTML.png","publishedAt":"2021-07-07T00:00:00Z","content":"

  • 1.Selim, A. & Abdelhady, A. Neosporosis among Egyptian camels and its associated risk factors. Trop.

  • BlazerGao commented 2 years ago

    final snapshot = useFuture( useMemoized(() { return context .read(loadingStateProvider) .whileLoading(mineViewModel.getUserFile); }, [userFile?.toString()]), );

    change to

    final snapshot = useFuture( useMemoized(() => context .read(loadingStateProvider) .whileLoading(mineViewModel.getUserFile)), );