'Flutter: redirect factory

I try do some like fabric for my default view.

/// Providing create access to create default snapshot state view.
abstract class DefaultSnapshotView extends StatelessWidget {
  /// Constructor.
  const DefaultSnapshotView({Key? key}) : super(key: key)

  /// Default loading view.
  const factory DefaultSnapshotView.loading({
    Key? key,
  }) = _Loading;

  // ... other factories like above. 
}

class _Loading extends DefaultSnapshotView {
  const _Loading({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const CircularProgressIndicator();
  }
}

but I have error enter image description here what I do wrong? and how I can fix it for const factory ... =



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source