admin管理员组

文章数量:1123776

I'm working on an app that utilizes some preferences for login. For this, I'm using the shared_preferences package. The preferences work fine, but when I made a script to clear them for testing purposes, I get a massive block of errors. I won't post them all here, but this is the first one:

../../../development/flutter/packages/flutter/lib/src/gestures/monodrag.dart:576:35: Error: The method 'Offset' isn't defined for the class 'DragGestureRecognizer'.
 - 'DragGestureRecognizer' is from 'package:flutter/src/gestures/monodrag.dart' ('../../../development/flutter/packages/flutter/lib/src/gestures/monodrag.dart').
Try correcting the name to the name of an existing method, or defining a method named 'Offset'.
      final Offset updatedDelta = Offset(averageX, averageY) - _lastUpdatedDeltaForPan;

This is a simpler copy of my script:

import 'package:shared_preferences/shared_preferences.dart';

Future<void> main() async {
  await _clearPrefs();
  print("Preferences cleared successfully.");
}

Future<void> _clearPrefs() async {
  final prefs = SharedPreferencesAsync();
  await prefs.remove('foo');
}

I'm running the script with dart run

Any help would be much appreciated, as I can't find anything like this online.

本文标签: Why does my flutter script for clearing preferences cause seemingly unrelated errorsStack Overflow