data_repository 1.0.1 copy "data_repository: ^1.0.1" to clipboard
data_repository: ^1.0.1 copied to clipboard

A repository layer for Flutter that unifies typed HTTP requests, interceptors, response caching, pagination and error normalisation behind one API.

example/lib/main.dart

import 'package:example/modules/post/views/post_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'dependency_injection.dart';

void main() async {
  await DependencyInjection.bootstrap();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Data Repository',
      theme: ThemeData(
        primarySwatch: Colors.deepOrange,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Examples')),
      body: ListView(children: [
        ListTile(
          title: const Text('Post list example'),
          subtitle: const Text('Fetching a list of posts'),
          onTap: () => Navigator.push(
              context, CupertinoPageRoute(builder: (c) => const PostScreen())),
        )
      ]),
    );
  }
}
6
likes
160
points
268
downloads

Documentation

API reference

Publisher

verified publisherwiseminds.cc

Weekly Downloads

A repository layer for Flutter that unifies typed HTTP requests, interceptors, response caching, pagination and error normalisation behind one API.

Homepage
Repository (GitHub)
View/report issues

Topics

#networking #http #rest #cache #api

License

MIT (license)

Dependencies

flutter, http, http_parser, mime, path_provider

More

Packages that depend on data_repository