fetchly 0.5.6
fetchly: ^0.5.6 copied to clipboard
Fetchly provides a streamlined and user-friendly approach to harnessing the power of Dio within your Flutter applications.
import 'package:example/request_handler.dart';
import 'package:fetchly/fetchly.dart';
import 'package:flutter/material.dart';
import 'screens/todo_view.dart';
void main() {
Fetchly.init(
baseUrl: 'https://dummyjson.com/',
onRequest: RequestHandler.onRequest,
onError: RequestHandler.onError,
printType: PrintType.print,
config: FetchlyConfig(printLimit: 3000, showHeader: true));
// to set token in header when user logged in
Fetchly.setToken('token_value');
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fetchly Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const TodoView(),
);
}
}