Skip to content
/ errno Public

Defines system error code constants for the OSs running the Dart platform

License

Notifications You must be signed in to change notification settings

rtmigo/errno

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pub Package Actions Status

Defines system error code constants for the OSs running the Dart platform.

With these numeric codes, the OSError.errorCode property usually specifies the problem that occurred.

OS Class
Android, Linux LinuxErrors
iOS, macOS DarwinErrors
Windows WindowsErrors

Example

import 'dart:io';

import 'package:errno/errno.dart';

void main() {

  try {

    var lst = Directory("My Documents").listSync();
    print(lst);

  } on FileSystemException catch (exc) {

    if (exc.osError?.errorCode == WindowsErrors.pathNotFound) {
      
      print("The directory does not exist.");

    } else {
      rethrow;
    }
  }
}