delayed_main.dart 951 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';

import 'gallery/app.dart';

Object? createGarbage() {
  final List<dynamic> garbage = <dynamic>[];
  for (int index = 0; index < 1000; index += 1) {
    final List<int> moreGarbage = List<int>.filled(1000, index);
    if (index.isOdd) {
      garbage.add(moreGarbage);
    }
  }
  return garbage;
}

Future<void> main() async {
  // Create some garbage, and simulate some delays between that could be
  // plugin or network call related.
  final List<dynamic> garbage = <dynamic>[];
  for (int index = 0; index < 20; index += 1) {
    final Object? moreGarbage = createGarbage();
    if (index.isOdd) {
      garbage.add(moreGarbage);
      await Future<void>.delayed(const Duration(milliseconds: 7));
    }
  }

  runApp(const GalleryApp());
}