Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The method 'compute' isn't defined for the class '_RestClient'. #712

Open
android-dev2015 opened this issue Sep 24, 2024 · 2 comments
Open

Comments

@android-dev2015
Copy link

lib/example.g.dart:252:22: Error: The method 'compute' isn't defined for the class '_RestClient'.

  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    _value = await compute(
    ^^^^^^^
    lib/example.g.dart:288:19: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    : await compute(
    ^^^^^^^
    lib/example.g.dart:325:21: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    await compute(
    ^^^^^^^
    lib/example.g.dart:362:25: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    await compute(
    ^^^^^^^
    lib/example.g.dart:397:21: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    await compute(deserializeUserList,
    ^^^^^^^
    lib/example.g.dart:429:22: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    _value = await compute(deserializeUser, _result.data!);
    ^^^^^^^
    lib/example.g.dart:462:19: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    : await compute(deserializeUser, _result.data!);
    ^^^^^^^
    lib/example.g.dart:477:19: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    r'u': await compute(serializeUser, user)
    ^^^^^^^
    lib/example.g.dart:505:34: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    queryParameters.addAll(await compute(serializeUser, user));
    ^^^^^^^
    lib/example.g.dart:534:25: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    final _data = await compute(serializeUserList, users);
    ^^^^^^^
    lib/example.g.dart:561:24: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    _data.addAll(await compute(serializeUser, user));
    ^^^^^^^
    lib/example.g.dart:590:17: Error: The method 'compute' isn't defined for the class '_RestClient'.
  • '_RestClient' is from 'package:flutter_example/example.dart' ('lib/example.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'compute'.
    : await compute(serializeUser, user));
    ^^^^^^^
    Target kernel_snapshot_program failed: Exception
@panhs
Copy link

panhs commented Dec 13, 2024

@RESTapi(baseUrl: 'http://xxx.com', parser: Parser.FlutterCompute), remove 'parser: Parser.FlutterCompute'

@shorbenko
Copy link

If you encounter an error like: The method 'compute' isn't defined for the type '_RestClient', it’s because the compute function is part of the Flutter framework and needs to be imported explicitly. To fix this, add the following import statement at the top of your file:

import 'package:flutter/foundation.dart';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants