api_apptimus 0.0.6 copy "api_apptimus: ^0.0.6" to clipboard
api_apptimus: ^0.0.6 copied to clipboard

A comprehensive Flutter package for simplifying API integration

example/lib/main.dart

import 'package:api_apptimus/api_apptimus.dart';
import 'package:flutter/material.dart';

void main() {
  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: 'Api Integration',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Simple Api Integration'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  final ApiBaseRequsets _apiBaseRequsets = ApiBaseRequsets();

  void _incrementCounter() {
    setState(() {
      _apiBaseRequsets.get("https://your/api");
      _counter++;
    });
  }

  //way to use the api_apptimus package

  // Future<ApiResult<List<YourModel>>> getSectionHeadings() async {
  //   try {
  //     var response = await _apiBaseRequsets.get('api/course/your/api');

  //     return ApiResult.success(response);
  //   } catch (e) {
  //     return ApiResult.failure(NetworkExceptions.getDioException(e));
  //   }
  // }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
3
likes
130
points
79
downloads

Publisher

unverified uploader

Weekly Downloads

A comprehensive Flutter package for simplifying API integration

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter, freezed_annotation

More

Packages that depend on api_apptimus