Last active
March 2, 2022 20:02
-
-
Save pawelsa/18efc57b6509a44910a21eda9f127168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Response {} | |
abstract class SuccessfulResponse extends Response {} | |
abstract class ErrorResponse extends Response {} | |
abstract class Api { | |
Future<Response> get(Uri uri, Response Function(String body) mapper) { | |
return http.get(uri).then((value) => mapper(value.body)); | |
} | |
// HTTP Post, Put, Delete and others can also be added here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment