import 'package:async_builder/async_builder.dart';
import 'package:flutter/material.dart';
class ClassName extends StatelessWidget {
final Future<int> _f;
const ClassName(Future<int> f, {super.key}) : _f = f;
@override
Widget build(BuildContext context) {
return AsyncBuilder<int>(
future: _f,
waiting: (context) => Text('waiting'),
error: (context, error, stackTrace) => Text('error $error'),
builder: (BuildContext context, int? value) {
return Text('the value is $value');
},
);
}
}
Why the type of value is int? and not int? in what case it would be null?
Why the type of
valueisint?and notint? in what case it would benull?