Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
How to implement the suspend keyword to modify higher-order functions in kotlin poet

I want to modify higher-order functions with the ”suspend“ keyword. The following is what I want:

public fun login(io: suspend () -> ResLogin): Unit {}

I tried to use:

val lambdaTypeName = LambdaTypeName.get(returnType = responseBean)

But get the following code:

public fun login(io: () -> ResLogin): Unit {}

I don’t know how to start, and the official website API has been checked for a long time and I haven’t found a similar answer. I hope the boss will give instructions!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer has been found, it can be solved by LambdaTypeName.copy(suspending = true), the specific code is as follows:

val lambdaTypeName = LambdaTypeName.get(returnType = responseBean)
                FunSpec.builder(it.methodName).addParameter(ParameterSpec.builder("io",lambdaTypeName.copy(suspending = true)).build())
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!