Fetching but Type Conversion Err
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:witl/album_fetch.dart';
|
||||
|
||||
class FetchAPI extends StatelessWidget {
|
||||
class FetchAPI extends StatefulWidget {
|
||||
const FetchAPI({super.key});
|
||||
|
||||
@override
|
||||
State<FetchAPI> createState() => _FetchAPIState();
|
||||
}
|
||||
|
||||
class _FetchAPIState extends State<FetchAPI> {
|
||||
late Future<FetchAlbum> fetchedAlbum;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
fetchedAlbum = fetchArrivals();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -11,6 +25,18 @@ class FetchAPI extends StatelessWidget {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
FutureBuilder<FetchAlbum> (
|
||||
future: fetchedAlbum,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return Text(snapshot.data!.timeOfDay);
|
||||
} else if (snapshot.hasError) {
|
||||
return Text('${snapshot.error}');
|
||||
}
|
||||
|
||||
return const CircularProgressIndicator();
|
||||
},
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
|
||||
Reference in New Issue
Block a user