Skip to content

Commit

Permalink
Format done
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham16g committed Jan 11, 2023
1 parent b579823 commit 16020b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/src/view_model.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/// [ViewModel] is an abstract class with an abstract method [dispose].
abstract class ViewModel {
void init() {}

void init(){}
/// used to dispose all the flows.
void dispose();
}

/// This will help to easily implement PostFrameCallback event into ViewModel.
/// [onPostFrameCallback] will trigger after the ui build completed.
abstract class PostFrameCallback {

void onPostFrameCallback(Duration timestamp);
}
4 changes: 2 additions & 2 deletions lib/src/view_model_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class _ViewModelProviderState<T extends ViewModel>
super.initState();
_viewModel.init();
if (_viewModel is PostFrameCallback) {
WidgetsBinding.instance
.addPostFrameCallback((_viewModel as PostFrameCallback).onPostFrameCallback);
WidgetsBinding.instance.addPostFrameCallback(
(_viewModel as PostFrameCallback).onPostFrameCallback);
}
}

Expand Down

0 comments on commit 16020b5

Please sign in to comment.