cached_resource 1.0.0 copy "cached_resource: ^1.0.0" to clipboard
cached_resource: ^1.0.0 copied to clipboard

Cached resource implementation based on `NetworkBoundResource` to follow the single source of truth principle.

example/lib/main.dart

// Copyright 2024 The Cached Resource Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:cached_resource/cached_resource.dart';
import 'package:flutter/material.dart';
import 'package:resource_storage_hive/resource_storage_hive.dart';
import 'package:resource_storage_secure/resource_storage_secure.dart';

import 'product_list_page.dart';

void main() {
  // Configuration for cached_resource.
  // Here you can provide storage implementation for In-Memory,
  // persistent and secure storages. Also you can set a custom logger.
  ResourceConfig.setup(
    persistentStorageFactory: const HiveResourceStorageProvider(),
    secureStorageFactory: const FlutterSecureResourceStorageProvider(),
  );

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Cached Resource Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const ProductListPage(),
    );
  }
}
3
likes
0
pub points
55%
popularity

Publisher

unverified uploader

Cached resource implementation based on `NetworkBoundResource` to follow the single source of truth principle.

Repository (GitHub)
View/report issues

Topics

#storage #cache

License

unknown (LICENSE)

Dependencies

collection, resource_storage, rxdart, synchronized

More

Packages that depend on cached_resource