misTypedArgsRoute<T> function Null safety

PageRoute misTypedArgsRoute<T>(
  1. Object args
)

Implementation

PageRoute misTypedArgsRoute<T>(Object args) {
  return MaterialPageRoute(
    builder: (ctx) => Scaffold(
      body: Container(
        color: Colors.redAccent,
        width: double.infinity,
        padding: const EdgeInsets.symmetric(horizontal: 16.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Arguments Mistype!',
              textAlign: TextAlign.center,
              style: const TextStyle(fontSize: 20),
            ),
            const SizedBox(height: 8.0),
            Text(
              'Expected (${T.toString()}),  found (${args.runtimeType})',
              textAlign: TextAlign.center,
            ),
            const SizedBox(height: 16.0),
            OutlinedButton.icon(
              label: Text('Back'),
              icon: Icon(Icons.arrow_back),
              onPressed: () => Navigator.of(ctx).pop(),
            )
          ],
        ),
      ),
    ),
  );
}