Skip to content
New issue

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

Only start stopwatch when dataTableShowLogs && kDebugMode is true #278

Open
stan-at-work opened this issue May 2, 2024 · 1 comment
Open

Comments

@stan-at-work
Copy link

stan-at-work commented May 2, 2024

Now every build a stopwatch is created in debug and release mode.

If the properties dataTableShowLogs && kDebugMode are not true, it's created and started every build.

This is unnecessary.

Quick fix:
Now

  @override
  Widget build(BuildContext context) {
    var sw = Stopwatch();
    sw.start();
    
    ...
    
    sw.stop();

    if (dataTableShowLogs && kDebugMode) {
      debugPrint('DataTable2 built: ${sw.elapsedMilliseconds}ms');
    }

How it could be

    Stopwatch? sw;
    
  @override
  Widget build(BuildContext context) {
     if (dataTableShowLogs && kDebugMode){
     sw = Stopwatch();
     sw.start();
     }
    
...

    if (dataTableShowLogs && kDebugMode) {
      sw.stop();
      debugPrint('DataTable2 built: ${sw.elapsedMilliseconds}ms');
    }
@npateras
Copy link

npateras commented Jun 7, 2024

And also pls add a property to disable the debug completely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants