nookipedia_flutter 0.2.6 copy "nookipedia_flutter: ^0.2.6" to clipboard
nookipedia_flutter: ^0.2.6 copied to clipboard

Flutter wrapper for Nookipedia API. The Nookipedia API provides endpoints for retrieving Animal Crossing data pulled from the Nookipedia wiki.

example/lib/main.dart

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

void main() {
  NookipediaClient.initialize(
    apiKey: "API-KEY-HERE",
  );
  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: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: FutureBuilder(
        future: NookipediaClient.instance.clothing
            .fetchNames(category: ClothingCategory.dressUp),
        builder: ((context, AsyncSnapshot<List<String>> snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return const Center(child: CircularProgressIndicator());
          }
          if (snapshot.hasError) {
            return Text(snapshot.error?.toString() ?? "Something went wrong");
          }
          var data = snapshot.data!;
          return ListView.builder(
            itemCount: data.length,
            itemBuilder: ((context, index) {
              return ListTile(title: Text(data[index]));
            }),
          );
        }),
      ),
    );
  }
}
0
likes
160
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter wrapper for Nookipedia API. The Nookipedia API provides endpoints for retrieving Animal Crossing data pulled from the Nookipedia wiki.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, equatable, flutter, json_annotation

More

Packages that depend on nookipedia_flutter