It is not possible to create a perfect gradient
It is not possible to create a gradient over a distance of 256 pixel that has a different greyscale value for each pixel. This behaviour cannot be changed with the "Dither" checkbox. I would suggest to implement another checkbox called "Pixel Perfect" (or similar) which will do what you would expect: get the distance of the gradient, divide it through the number of values to blend and distribute them equally. So, with such an option I would expect a 256 pixel gradient with black and white to have an incremental increase of greyscale values by 1 per pixel.