Line data Source code
1 : import 'package:flutter/material.dart';
2 :
3 : import 'package:fast_immutable_collections/fast_immutable_collections.dart';
4 :
5 : import '../../types/red_fire_state.dart';
6 : import '../models/page_data.dart';
7 :
8 : /// We are using extensions in order to keep models as PODOs and avoid other
9 : /// dependencies in the app state.
10 : extension PageDataListExtension on IList<PageData> {
11 : /// Creates a list of [MaterialPage] from a list of [PageData]
12 : /// - used as the history for [Navigator]
13 2 : List<Page> toPages<T extends RedFireState>() {
14 2 : return map<Page>(
15 12 : (pageData) => toMaterialPageMap[pageData.typeName]!(pageData)).toList();
16 : }
17 : }
|