We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Visibility
Unhandled exception: Converting object to an encodable object failed: Instance of 'Visibility' #0 _JsonStringifier.writeObject (dart:convert/json.dart:793:7) #1 _JsonStringifier.writeMap (dart:convert/json.dart:874:7) #2 _JsonStringifier.writeJsonValue (dart:convert/json.dart:829:21) #3 _JsonStringifier.writeObject (dart:convert/json.dart:784:9) #4 _JsonStringStringifier.printOn (dart:convert/json.dart:982:17) #5 _JsonStringStringifier.stringify (dart:convert/json.dart:967:5) #6 JsonEncoder.convert (dart:convert/json.dart:345:30) #7 JsonCodec.encode (dart:convert/json.dart:231:45) #8 jsonEncode (dart:convert/json.dart:114:10) #9 ServiceHelper.post (package:mastodon_api/src/core/service_helper.dart:167:23) #10 BaseService.post (package:mastodon_api/src/service/base_service.dart:166:21) #11 _StatusesV1Service.createStatus (package:mastodon_api/src/service/v1/statuses/statuses_v1_service.dart:876:21) #12 main (redacted.dart) #13 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:294:33) #14 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
The code should just work (i.e. post a toot)
import 'package:mastodon_api/mastodon_api.dart'; // the bulk of this is straight copy-paste from the example in the readme void main(List<String> args) async { final mastodon = MastodonApi( instance: args[0], bearerToken: args[1], retryConfig: RetryConfig( maxAttempts: 5, jitter: Jitter( minInSeconds: 2, maxInSeconds: 5, ), onExecute: (event) => print( 'Retry after ${event.intervalInSeconds} seconds... ' '[${event.retryCount} times]', ), ), ); try { final response = await mastodon.v1.statuses.createStatus( text: 'Toot!', visibility: Visibility.private, ); print(response.rateLimit); print(response.data); } on UnauthorizedException catch (e) { print(e); } on RateLimitExceededException catch (e) { print(e); } on MastodonException catch (e) { print(e.response); print(e.body); print(e); } }
mastodon_api: ^0.6.1
The text was updated successfully, but these errors were encountered:
Thanks for your contribution! :)
Sorry, something went wrong.
myConsciousness
No branches or pull requests
1. Current bug behavior
2. Expected behavior
The code should just work (i.e. post a toot)
3. Steps to reproduce
The text was updated successfully, but these errors were encountered: