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

A client to connect to m.animeflv.net

example/lib/main.dart

import 'dart:convert';

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

void main() {
  runApp(const AnimeExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AnimeFLV Client Example',
      theme: ThemeData.dark(),
      home: const AnimeListScreen(),
    );
  }
}

class AnimeListScreen extends StatefulWidget {
  const AnimeListScreen({super.key});

  @override
  State<AnimeListScreen> createState() => _AnimeListScreenState();
}

class _AnimeListScreenState extends State<AnimeListScreen> {
  final apiClient = AnimeFLVClient();
  late Future<List<Anime>> _animeFuture;

  @override
  void initState() {
    super.initState();
    _animeFuture = apiClient.getAnimeInEmission();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Animes en Emisión'),
      ),
      body: FutureBuilder<List<Anime>>(
        future: _animeFuture,
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return const Center(child: CircularProgressIndicator());
          } else if (snapshot.hasError) {
            return Center(child: Text('Error: ${snapshot.error}'));
          } else if (!snapshot.hasData || snapshot.data!.isEmpty) {
            return const Center(child: Text('No se encontraron animes.'));
          }

          final animes = snapshot.data!;

          return ListView.builder(
            itemCount: animes.length,
            itemBuilder: (context, index) {
              final anime = animes[index];
              return ListTile(
                leading: const Icon(Icons.movie),
                title: Text(anime.title),
                subtitle: const Text('Click para ver detalles'),
                onTap: () async {
                  final data = await apiClient.getAnimeData(anime.authorityUrl + anime.url);
                  debugPrint('Datos cargados: ${jsonEncode(data.toJson())}');
                },
              );
            },
          );
        },
      ),
    );
  }
}
0
likes
120
points
40
downloads

Documentation

API reference

Publisher

verified publisherskizofrenks.xyz

Weekly Downloads

A client to connect to m.animeflv.net

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, html, http

More

Packages that depend on animeflv_client