flutter_delay_fetch 1.1.0

Flutter Android iOS web

A flutter plugin to put a delay between fetch request and parsing data with a mixin, during page route navigation to avoid laggy animations.

Flutter Delay Fetch #

pub package

A flutter plugin to put a delay between fetch request and parsing data with a mixin, during page route navigation to avoid laggy animations.

Usage #

Import #

import 'package:flutter_delay_fetch/flutter_delay_fetch.dart';

Basic Page #

class FetchPage extends StatefulWidget {
  @override
  _FetchPageState createState() => _FetchPageState();
}

class _FetchPageState extends State<FetchPage> with DelayedFetchMixin<Response, FetchPage> {
  bool _loading = true;
  List<TodoModel> _todos;

  @override
  Future<Response> fetch() async => await Dio().get('https://jsonplaceholder.typicode.com/posts');

  @override
  void onSuccess(Response response) {
    setState(() {
      _todos = (response.data as List).map((data) => TodoModel.fromJson(data)).toList();
      _loading = false;
    });
  }

  @override
  void onError(error) { ... }

  @override
  Widget build(BuildContext context) { ... }
}
2
likes
90
pub points
23%
popularity

Publisher

jroussel.fr

A flutter plugin to put a delay between fetch request and parsing data with a mixin, during page route navigation to avoid laggy animations.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_delay_fetch