Skip to content

Why the type of value is int? and not int? in what case it would be null? #8

Description

@stephane-archer
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions