Skip to content

Instantly share code, notes, and snippets.

@panthe
Last active November 13, 2020 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panthe/420860dea32c4f94306c8d999962e9fd to your computer and use it in GitHub Desktop.
Save panthe/420860dea32c4f94306c8d999962e9fd to your computer and use it in GitHub Desktop.
A typical Redux action
import 'package:flutter/material.dart';
import 'package:flutter_web_with_redux/models/user.dart';
class FetchingUser {
bool isFetching;
FetchingUser({
@required this.isFetching,
});
toJson() {
return {
'isFetching': isFetching,
};
}
}
class FetchUser {}
class SetUser {
final User user;
SetUser({
@required this.user,
});
toJson() {
return {
'user': user?.toJson(),
};
}
}
class SavingUser {
bool isSaving;
SavingUser({
@required this.isSaving,
});
toJson() {
return {
'isSaving': isSaving,
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment