Skip to content

Example fails with await TimeMachine #66

@mikeyyyzhao

Description

@mikeyyyzhao

I'm new to Flutter but when I run the example with await TimeMachine.initialize({'rootBundle': rootBundle}), it fails with the message "the await expression can only be used in an async function." However, when I take out the await, the error goes away. Is the doc not up to date or am I doing something wrong with the setup??

#pubspec.yaml

dependencies:
  time_machine:
    git:
      url: https://github.com/Dana-Ferguson/time_machine
      ref: master

# The following section is specific to Flutter.
flutter:
  assets:
    - packages/time_machine/data/cultures/cultures.bin
    - packages/time_machine/data/tzdb/tzdb.bi

#main.dart

import 'package:flutter/services.dart';
import 'package:time_machine/time_machine.dart';


void main() {
  WidgetsFlutterBinding.ensureInitialized();
  await TimeMachine.initialize({'rootBundle': rootBundle});

  runApp(MyApp());
}

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