Skip to content

Example fails with await TimeMachine #66

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());
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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