flutter_model_cache 0.0.13 copy "flutter_model_cache: ^0.0.13" to clipboard
flutter_model_cache: ^0.0.13 copied to clipboard

A local cache for models that are accessed over json apis.

example/flutter_model_cache_example.dart

import 'package:flutter_model_cache/flutter_model_cache.dart';

class Animal extends Model {
  final String name;
  Animal({required this.name});

  static const String classCollectionName = 'animals';
  @override
  String get collectionName => classCollectionName;

  factory Animal.fromJson(Map<String, Object?> json) {
    return Animal(name: json['name'] as String);
  }
}

void main() async {
  final modelFactory = ModelFactory();
  modelFactory.registerModelClass(
    Animal.classCollectionName,
    (json) => Animal.fromJson(json),
  );
  final animal = await modelFactory.findModel(Animal.classCollectionName, 1);
  print(animal);
}
1
likes
140
points
77
downloads

Publisher

verified publisherfeirmapp.ie

Weekly Downloads

A local cache for models that are accessed over json apis.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, flutter_secure_storage, http

More

Packages that depend on flutter_model_cache