-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'src/rust/frb_generated.dart'; | ||
import 'src/rust/api/fsrs_api.dart'; | ||
|
||
Future<void> example() async { | ||
// Initialize the Rust bridge | ||
await RustLib.init(); | ||
|
||
// Create a new FSRS instance with default parameters | ||
final fsrs = await Fsrs.newInstance( | ||
parameters: List<double>.from([ | ||
0.4, 0.6, 2.4, 5.8, 4.93, 0.94, 0.86, 0.01, 1.49, 0.14, 0.94, | ||
2.18, 0.05, 0.34, 1.26, 0.29, 2.61, 0.05, 0.4 | ||
]), | ||
); | ||
|
||
// Example: Calculate next states for a new item | ||
// Initial review with no prior memory state | ||
final nextStates = fsrs.nextStates( | ||
currentMemoryState: null, // No prior state for new items | ||
desiredRetention: 0.9, // 90% retention target | ||
daysElapsed: 0, // First review | ||
); | ||
|
||
// Print the results | ||
print('Next states calculated:'); | ||
print('Again state: ${(nextStates.again).interval} days'); | ||
print('Hard state: ${(nextStates.hard).interval} days'); | ||
print('Good state: ${(nextStates.good).interval} days'); | ||
print('Easy state: ${(nextStates.easy).interval} days'); | ||
} |
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