taro 1.1.0 copy "taro: ^1.1.0" to clipboard
taro: ^1.1.0 copied to clipboard

Taro is a library for loading data from network and saving it to storage to speed up data loading.

example/lib/main.dart

import 'package:dio/dio.dart';
import 'package:example/app.dart';
import 'package:example/dio_http.dart';
import 'package:example/http_http.dart';
import 'package:flutter/material.dart';
import 'package:taro/taro.dart';

enum HttpMode {
  http,
  dio,
  none,
}

void main() {
  const mode = HttpMode.none;
  switch (mode) {
    case HttpMode.http:
      Taro.instance.networkLoader = const TaroLoaderNetwork(
        client: HttpHttp(),
      );
    case HttpMode.dio:
      Taro.instance.networkLoader = TaroLoaderNetwork(
        client: DioHttp(
          dio: Dio()
            ..options.connectTimeout = const Duration(seconds: 10)
            ..options.receiveTimeout = const Duration(seconds: 10),
        ),
      );
    case HttpMode.none:
      break;
  }

  runApp(const App());
}
1
likes
140
pub points
25%
popularity

Publisher

unverified uploader

Taro is a library for loading data from network and saving it to storage to speed up data loading.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

clock, crypto, flutter, image, path_provider

More

Packages that depend on taro